2011-10-19 55 views
0

我正在使用BXslider,我希望更新图像。 这是代码片段:使用Jquery更新图像

$(function(){ 
    $('#slider1').bxSlider({ 
    auto: true, 
    pager: true, 
    buildPager: function(slideIndex){ 
    switch (slideIndex){ 
     default: 
      return '<a href=""><img src="/images/loginPage/dot_empty.png" style="margin:2px;" /></a>'; 
     } 
    } 
    }); 
}); 

使用的CSS是: -

a.pager-active > img{ 
    border-bottom: 2px solid #DE312A !important; 
    background: url("/images/loginPage/dot_filled.png") no-repeat scroll 1px 0 !important; 
    z-index:2; 
} 
.bx-pager a{ 
    text-decoration:none; 
    color:transparent; 
} 
.bx-pager a > img{ 
    border-bottom: 2px solid blue; 
    z-index:0; 
    //background: url("/images/loginPage/dot_filled.png") no-repeat scroll 1px 0 transparent; 
} 

精灵形象是: enter image description here

请给我建议的方式来更新图片src,我尝试使用CSS条纹以及。 在此先感谢!

+0

请提供您的输入 – vedvrat13

回答

1

所有您需要做的是改变图像的源:

$(SELECTOR_FOR_IMAGE).attr('src', NEW_VALUE); 

你没有提供有关您的标记的其余部分的外观的任何信息,所以我不能比这更明确,但这就是改变图像的源属性的一切。