0

我有一个小问题:

This is a script I have for page on load too fade in and show a login box but the code only works to the fade in and ignores the reveal. How do I solve?

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

Below is the code that controls the behavior of the contact box.

$(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;
    });
});
4

1 回答 1

1

您需要在 fadeIn 函数中调用回调函数。所以它看起来像:

$('body').hide().fadeIn('8000', function () {
            $('#login-window').reveal();
});
于 2013-04-11T22:28:17.557 回答