2013-04-11 37 views
0

我有一個小問題:jQuery的使用Javascript - 箱負載

這是一個腳本我有負載頁面太淡出,並顯示一個登錄框,但該代碼只能在褪色,而忽略揭示。我如何解決?

<script> 
    $(document).ready(function() { 
     $('body').hide().fadeIn('8000'); { 
      $('#login-window').reveal(); 
     }); 
</script> 

下面是控制聯繫人框行爲的代碼。

$(document).ready(function() { 
    $('a.login-window').click(function() { 

     // Getting the variable's value from a link 
     var contactpopup = $(this).attr('href'); 

     //Fade in the Popup and add close button 
     $(contactpopup).fadeIn(300); 

     //Set the center alignment padding + border 
     var popMargTop = ($(contactpopup).height() + 24)/2; 
     var popMargLeft = ($(contactpopup).width() + 24)/2; 

     $(contactpopup).css({ 
      'margin-top': -popMargTop, 
       'margin-left': -popMargLeft 
     }); 

     // Add the mask to body 
     $('body').append('<div id="mask"></div>'); 
     $('#mask').fadeIn(300); 

     return false; 
    }); 

    // When clicking on the button close or the mask layer the popup closed 
    $('a.close, #mask').live('click', function() { 
     $('#mask , .contact-popup').fadeOut(300, function() { 
      $('#mask').remove(); 
     }); 
     return false; 
    }); 
}); 

回答

1

您需要在fadeIn函數中調用回調函數。所以它看起來像:

$('body').hide().fadeIn('8000', function() { 
      $('#login-window').reveal(); 
}); 
+0

我試過這個,但沒有運氣,讓我檢查,並確保如果我有一切正確。 –

+0

你有一個'{'沒有任何關閉 – RicardoGonzales