簡體   English   中英

jQuery Waypoint協助

[英]JQuery Waypoints Assistance

我已經離開網頁設計已有一段時間了,有人要求我提供有關重現此效果的幫助: 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
    });
 });

});

$(document.body).css({
    'background-image': 'url(' + backgroundSrc + ')'
});

使用jQuery CSS屬性設置背景圖像

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM