2015-03-31 40 views
0

即時嘗試在5秒後淡入視頻,然後按下按鈕後淡出視頻,然後將頁面滾動到下一部分。我的動畫無法按預期工作

在下一節中,它應該爲一些div製作動畫,然後....按下按鈕轉到下一節,淡入淡出之前動畫的div,然後進入下一節。

第三個滾動按鈕根本不起作用。

只有最後2個滾動按鈕的工作....我不明白爲什麼只有這些最後2,而不是前3周。

注:Id也喜歡殺死頁面上的滾動條,並通過滾動按鈕導航頁面。這裏是我的代碼是給我找麻煩:

<script> 


$(document).ready(function(){ 

//Kill Page Scrollbar  
$('html, body').css({ 
    'overflow': 'hidden', 
    'height': '100%' 
}); 


//animate the registration video fading in 
$('#Video').fadeTo(3000, 1); 
//Make scrollbutton clickable 
$('.ScrollButton_White1').click(function(){ 
//Fade Video out 
    $('#Video').fadeTo(3000, 0), (function(){ 
//define the variable "diamonds" 
    var diamonds = $('#PresenterContainer').children() 
//animate the scrolling of the page down to the anchor point//          
$('html, body').animate({ 
    scrollTop: $("#PresenterContainer_AnchorPoint").offset().top 
    }, 5000, 
          function() { 
     diamonds.show(); 

          }); 
    }); 
}); 

<!--scroll button 2-->    
$('.ScrollButton_Gold1').click(function(){ 

     diamonds.hide(); 

$('html, body').animate({ 
      scrollTop: $("#YouAskedForIt_AnchorPoint").offset().top 
        }, 5000 
); 
}); 


<!--scroll button 3--> 
$('.ScrollButton_White3').click(function(){ 

     $('html, body').animate({ 
      scrollTop: $("#ReturnChampion_AnchorPoint").offset().top 
        }, 5000 
);                 
}); 

<!--scroll button 4--> 
$('.ScrollButton_Gold1').click(function(){ 

     $('html, body').animate({ 
      scrollTop: $("#YouAskedForIt_AnchorPoint").offset().top 
        }, 5000);     


       }); 

<!--scroll button 5--> 
$('.ScrollButton_Gold2').click(function(){ 

     $('html, body').animate({ 
      scrollTop: $("#WhatYouWillLearn_AnchorPoint").offset().top 
        }, 5000);     


       }); 

<!--animate presenter diamond buttons--> 
<!--$(window).scroll(function(event) { 


      <!--$('#Diamond_DarrenHardy').addClass('animate_rf'); 
      <!--$('#Diamond_RobertKiyosaki').addClass('animate_rf');--> 



    <!--}); 

<!--end jquery script-->  
}); 
</script> 
+0

看來你正在創造一些東西,嘗試使用現場活動。 – stanze 2015-03-31 05:20:28

+0

我該怎麼做? – WillingLearner 2015-03-31 05:52:59

+0

-2-和-4都使用相同的選擇器'.ScrollButton_Gold1'。 '鑽石'是-1的本地化,但是-2-嘗試使用它。你應該在你的控制檯中看到一個錯誤。在寫作/檢查你的代碼時更加謹慎。 – 2015-03-31 05:58:50

回答

0

你似乎有一個錯字在你的代碼

$('#Video').fadeTo(3000, 0), (function() { 
     //define the variable "diamonds" 
     var diamonds = $('#PresenterContainer').children() 
     //animate the scrolling of the page down to the anchor point// 
     $('html, body').animate({ 
       scrollTop: $("#PresenterContainer_AnchorPoint").offset().top 
      }, 5000, 
      function() { 
       diamonds.show(); 

      }); 
    }); 

$('#Video').fadeTo(3000, 0), (function() {如果您正在尋找使用fadeTo的回調功能應該是

$('#Video').fadeTo(3000, 0, function() { 
     //define the variable "diamonds" 
     var diamonds = $('#PresenterContainer').children() 
     //animate the scrolling of the page down to the anchor point// 
     $('html, body').animate({ 
       scrollTop: $("#PresenterContainer_AnchorPoint").offset().top 
      }, 5000, 
      function() { 
       diamonds.show(); 

      }); 
    }); 
+0

我的代碼仍然沒有按照我想要的方式行事,即使在編輯時也是如此。現在它在頁面加載後立即生成滾動動畫....不找那個 – WillingLearner 2015-03-31 05:54:50

+0

我更新的代碼應該已經進入點擊處理程序。你能不能把你的代碼放在一個JSFiddle中 – DGS 2015-03-31 05:55:49

+0

http://jsfiddle.net/c7Lvs3kj/1/ – WillingLearner 2015-03-31 06:12:44