【发布时间】:2013-11-15 02:12:52
【问题描述】:
我已经有一段时间没有做网页设计了,有人请我帮忙重现这个效果:http://www.jetsetter.com/destinations/italy?nm=destinations
在别人的帮助下,我已经很接近这里了,但现在我无法改变背景。当我更改背景颜色而不是背景图像时,它可以工作。
有人可以看看我错过了什么吗?
$(document).ready(function(){
// attach a waypoint to each div.waypoint element
// the callback is executed every time the user scrolls past
// see http://imakewebthings.com/jquery-waypoints/#docs
$('.waypoint').waypoint(function(direction){
// you can use the direction parameter here to check which way the user was scrolling if you need
// get the background-image source from the data-src property on the DOM element
var backgroundSrc = $(this).attr('data-src');
// now update the CSS for the body
$(document.body).css({
'background-image': backgroundSrc
});
});
});
【问题讨论】:
标签: javascript jquery jquery-waypoints