html:
<a href="" class="learn-more" rel="0">Learn More</a>
<a href="" class="learn-more" rel="1" >Learn More</a>
<a href="" class="learn-more" rel="2" >Learn More</a>
<a href="" class="learn-more" rel="3" >Learn More</a>
<div class="LightBox">
<div class="LightBox_h"><img src="image/img0.jpg">your text</div>
<div calss="LightBox_b">your text</div>
<div calss="LightBox_f">your text</div>
</div><!--End LightBox-->
风格:
LightBox{display:none}
询问:
$('a').click(function(){
$('.LightBox').css({'display':'block'});
var i_see = parseInt($(this).attr('rel')); // you can use case
if ( i_see == 0){$('.LightBox_h').html('new next')}
else if (i_see ==1){$('.LightBox_h').html('new next')}
else if (i_see ==2){$('.LightBox_h').html('new next')}
else if (i_see ==3){$('.LightBox_h').html('new next')}
});
有些像这样
或者
var arr = ["img0" , "img1","img2" , "img3" ]; //sourse to img
$('a').click(function(){
$('.LightBox').css({'display':'block'});
var i_see = parseInt($(this).attr('rel'));
$('.LightBox_h img ').attr('src':'+ arr[i_see] +');
});