我已经离开网页设计很长一段时间了,有人向我寻求帮助来重现这种效果:http://www.jetsetter.com/destinations/italy?nm=destinations
在别人的帮助下,我离这里很近了,但现在我不能改变背景。当我改变背景颜色,而不是背景图像时,它就会起作用。
有没有人能看看我错过了什么?
http://jsfiddle.net/pfwwv/28/
$(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
});
});});
发布于 2013-11-15 10:28:29
$(document.body).css({
'background-image': 'url(' + backgroundSrc + ')'
});https://stackoverflow.com/questions/19992292
复制相似问题