1

我正在尝试 .animate (假设两个条件为真)或(否则) .fadeOut 元素:

if (window.location.hash == '' && window.scrollTop() == '0') {
     //do .animate

if (window.location.hash == '' && (window).scrollTop() == '0') {
     //do .animate

第一个有效,但窗口 scrollTop 我无法以正确的方式编写语法。

-格丽塔

PS这里是整个代码。除了顶部的 scrollTop 部分外,一切正常:

   if (window.location.hash == '' || $(window).scrollTop() == '0') {

        $('#preloader').delay(3000).animate({
                        width:'792px', left:'50%', top:'-.5cm', marginLeft:'-396px', opacity:'0.75'},600,'easeOutExpo').animate({        
                        height:'0px', top:'13cm', opacity:'0'}, 400, 'easeOutExpo', function(){ 
                $(this).remove();
        }); 
        $('#headerwrapper').addClass('delay55sec animated250 entryShot easeInExpo');
        $('#foot').animate({top:'-16cm'},0,'').delay(3700).animate({top:'0'},900,'easeOutBounce');
        $('.block-menu li a').animate({left:'-20cm'},0,'').delay(4000).animate({left:'0px'},1234,'easeInOutExpo');
        $('.bodoni').fadeTo(0, 0).delay(5000).fadeTo(1555, 1.0);  
        $('#content').hide(0).delay(5000).slideDown(999, 'easeInExpo');
        $('#nav').animate({left:'-1500px'},0,'').delay(6000).animate({'left': '0px'}, 1555, 'easeOutBounce');  

  } else {

        $.scrollTo($(window.location.hash+"_"), 4444, {axis:'y', easing:'easeInOutQuint'}); 
        $('#preloader').delay(600).fadeOut(3000, function(){ 
                $(this).remove();
        });            
  }
4

0 回答 0