0

我试图应用此代码:

nextText: '<img src="images/nextImgBtn.png" onmouseover="this.src='images/overnextImgBtn.png'" onmouseout="this.src='images/nextImgBtn.png '">',

prevText: '<img src="images/prevImgBtn.png" onmouseover="this.src='images/hoverprevImgBtn.png '" onmouseout="this.src='images/prevImgBtn.png '">'

jquery的这个准备调用函数

$(document).ready(function () {
    $('.slider1').bxSlider({
        slideWidth: 1050,
        minSlides: 1,
        maxSlides: 1,
        slideMargin: 10,
        infiniteLoop: true,
        hideControlOnEnd: false,
        mode: 'horizontal',
        video: true,
        useCSS: false,
        easing: 'easeOutElastic',
        speed: 2000,
        pagerCustom: '#bx-pager',
        nextSelector: '#slider-next',
        prevSelector: '#slider-prev',
        nextText: '<img src="images/nextImgBtn.png" onmouseover="this.src='
        images / hovernextImgBtn.png '" onmouseout="this.src='
        images / nextImgBtn.png '">',
        prevText: '<img src="images/prevImgBtn.png" onmouseover="this.src='
        images / hoverprevImgBtn.png '" onmouseout="this.src='
        images / prevImgBtn.png '">'
    });
});
4

2 回答 2

0

好吧,伙计。我认为您只是在设置文本。实际上谁知道这个小部件在那里接受什么,可能它是带有选择器的元素的 TEXT:

nextSelector: '#slider-next',
prevSelector: '#slider-prev',

你最好试试 CSS 解决方案

 #slider-next:hover{
    src:url(images/hovernextImgBtn.png)
 }
于 2013-09-02T15:33:39.293 回答
0

它只是语法错误,您需要转义引号。即使它不是最好的解决方案,它也应该可以解决您的问题:

nextText: '<img src="images/nextImgBtn.png" onmouseover="this.src=\'images/overnextImgBtn.png \'" onmouseout="this.src=\'images/nextImgBtn.png \'">',

prevText: '<img src="images/prevImgBtn.png" onmouseover="this.src=\'images/hoverprevImgBtn.png \'" onmouseout="this.src=\'images/prevImgBtn.png \'">'

Gena 的解决方案应该可行,并且可能是最好的解决方案。这个也应该工作

nextText: '<img src="images/nextImgBtn.png" id="slider-next">',
prevText: '<img src="images/prevImgBtn.png" id="slider-prev">

在你的 CSS 中:

#slider-prev:hover{
  src:url(images/hoverprevImgBtn.png)
}
#slider-next:hover{
  src:url(images/hovernextImgBtn.png)
}
于 2013-09-02T15:36:03.340 回答