简体   繁体   English

使用Jquery更新图像

[英]To Update image using Jquery

I am using BXslider and i wish to update the image. 我正在使用BXslider,并且希望更新图像。 This is the code snippet: 这是代码片段:

$(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>';
       }
    }
  });
});

The CSS used is:- 使用的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;
}

the sprite image is : 精灵图片是: 在此处输入图片说明

Kindly suggest me a way to update the image src, i tried using css stripes as well. 请给我建议一种更新图像src的方法,我也尝试使用css条纹。 Thanks in advance!! 提前致谢!!

All you have to do is this to change an image's source: 您要做的就是更改图像的来源:

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

You didn't provide any information about how the rest of your markup looks, so I can't be more explicit than that, but that's all that's involved in changing an image's source attribute. 您没有提供任何有关其余标记外观的信息,因此我没有比这更明确的了,但这就是更改图像的source属性所涉及的全部。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM