问题描述
我试图用jQuery交换两个图像。使用悬停事件我试过:
$(#wlt-DealView .buyButton_new)。mouseover(function(e){
$('。buyButton_new')。css('background-image','url(../ images / compra_mouseOver.png)');
});
$(#wlt-DealView .buyButton_new)。mouseout(function(e){
$('。buyButton_new')。css('background-image','url /compra_normal.png)');
});
但是图像没有显示,当我得到鼠标后,它触发第二个事件。
您可以在这里查看: http://107.20.186.103/
如果我尝试输入网址得到一个奇怪的500 ...
我想你应该得到你的图像文件准备好,它会工作。您也可以使用jQuery.hover函数调整您的代码。
I'm trying to swap two images with jQuery. Using the hover event I tried:
$("#wlt-DealView .buyButton_new").mouseover(function(e){
$('.buyButton_new').css('background-image','url(../images/compra_mouseOver.png)');
});
$("#wlt-DealView .buyButton_new").mouseout(function(e){
$('.buyButton_new').css('background-image','url(../images/compra_normal.png)');
});
But the image is not showing and after I get the mouse from it, it triggers the second event. It should update with the first image, but it doesn't.
You can have a look here: http://107.20.186.103/deals/cuerpon
.
Hover the BUY button.
If i try to enter the URL http://107.20.186.103/images/compra_mouseOver.png manually in my browser, i get a 404.
http://107.20.186.103/deals/images/compra_mouseOver.png gets a strange 500...
I think you should get your image files ready and it will work. You may also tweak your code by using the jQuery.hover function.
这篇关于jquery更改背景图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!