您好,我的项目有背景图片
background: url('img/1.JPG') fixed;
我试图在div悬停时使用jQuery更改此背景图片(".boxy")
。这是我设法在jQuery中完成的操作
$(document).ready(function() {
$(".boxy").hover(
function()
{
$("body").css(??????); //what should i write here in order to change background image in img/2.JPG
},
function()
{
$("body").css(??????); // what should i write here in order to chage background image in img/1.JPG
}
);
});
$(document).ready(function () {
$(".boxy").hover(function () {
$("body").css('backgroundImage', 'url(img/2.JPG)');
}, function () {
$("body").css('backgroundImage', 'url(img/1.JPG)');
});
});
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句