JQuery Vertical滑块在页面加载时打开和闪烁,手风琴,标签和Cufon闪烁

时间:2010-09-09 09:32:10

标签: jquery css html5

使用自定义jquery创建一个独立滑块和一个带有标签的独立手风琴。哪些都有效。但是当页面加载时如何阻止它们打开?!?!这种情况发生在所有浏览器中,加载大约需要2秒钟!

你需要

  • 用户名:列表
  • 密码:列表

我也使用闪烁并利用新闻自动收录器,在加载页面之前,Cufon也有闪烁。我正在使用所有页面底部的Cufon.now()功能。

该网站目前只是非常基本的PHP我包括带有php的滑块会让它开放吗?

我正在使用的脚本

<!-- Scripts -->
    <script type="text/javascript" src="/assets/scripts/jquery-1.4.2.min.js"></script>
    <script type="text/javascript" src="/assets/scripts/cufon-yui.js"></script>  
    <script type="text/javascript" src="/assets/scripts/Agenda_400-Agenda_700-Agenda_italic_400-Agenda_400.font.js"></script>  
    <script type="text/javascript" src="http://cdn.jquerytools.org/1.2.4/jquery.tools.min.js"></script>
    <script type="text/javascript" src="/assets/scripts/jquery.lightbox-0.5.min.js"></script>
    <script type="text/javascript" src="/assets/scripts/jquery.watermarkinput.js"></script>
    <script type="text/javascript" src="/assets/scripts/jquery.ticker.js"></script>
    <script type="text/javascript" src="/assets/scripts/animatedcollapse.js"></script>
    <script type="text/javascript" src="/assets/scripts/facebox.js"></script>
    <script type="text/javascript" src="/assets/scripts/jquery.cycle.all.min.js"></script>
    <script type="text/javascript" src="/assets/scripts/jquery-scripts.js"></script>
    <script type="text/javascript" src="/assets/scripts/accordion.js"></script>
        <!--[if IE 6]><script type="text/javascript" src="/assets/scripts/dd-belated-png.js">   
       </script><![endif]-->

的jquery-scripts.js中

//Login box
jQuery.fn.fadeToggle = function(speed, easing, callback) {
    return this.animate({opacity: 'toggle'}, speed, easing, callback);
};

// Scroll close all and back to top buttons with the page
$(window).scroll(function() {
    var top = $(this).scrollTop();

    if ($("#newsletter").length) {
        var pos = $("#newsletter").position();
        var p = pos.top - 511;

        if (top >= p) {
            top = p;
            $('#acc-close-all a, #to-top a').css('top', top + "px").css("display", "inline");
        } else {
            $('#acc-close-all a, #to-top a').css('top', top + "px").css("display", "inline");
        }
    } else {
        $('#acc-close-all a, #to-top a').css('top', top + "px").css("display", "inline");
    }
});

    $(function(){

    //font replacement


    Cufon.replace("h1:not(.nocufon),h2:not(.nocufon),h3:not(.nocufon),h4:not(.nocufon)", {hover: true});

    // Banner rotator
    $('#slider .items').cycle({
        fx: 'blindY',
        timeout: 9599
    });

    // Ticker
    $('#ticker .items').cycle({
        fx: 'fade',
        timeout: 7000
    });

    //pricing details
    $("div.pricing-more-info").hide();

    $("a.pricing-more").click(function () {
        //show details
        $(this.href.substring(this.href.indexOf("#"), this.href.length)).fadeToggle();
        return false;
    }); 

    $("div.pricing-more-info .close").click(function () {
        //hide details
        $(this).parent().fadeToggle();
        return false;
    });

    //lightboxsetup
    $(".screenshots a, .imagecaption-gallery a").lightBox();  

    //username input watermark
    $("#control-login-username").Watermark("username");
    $("#control-login-password").Watermark("password");

    // when the form is submitted
    $('#colo-quote').submit( function(){

        var reg_email = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z])+$/; 

        var inputcheck = $('#contact_name');
        // if field has something in it, do submit actions, otherwise write out error
        if( inputcheck.val() == '' ){
            // add class to change colour
            inputcheck.addClass("required").get(0).focus();
            return false;
        }else{ inputcheck.removeClass("required"); }

        var inputcheck = $('#business_name');
        if( inputcheck.val() == '' ){
            inputcheck.addClass("required").get(0).focus();
            return false;
        }else{ inputcheck.removeClass("required"); }

        var inputcheck = $('#email_address');
        if( inputcheck.val() == '' || !reg_email.test( inputcheck.val() ) ){
            inputcheck.addClass("required").get(0).focus();
            return false;
        }else{ inputcheck.removeClass("required"); }

    }); 

    // Info box
    animatedcollapse.addDiv('info', 'fade=1,hide=1');
    animatedcollapse.ontoggle=function($, divobj, state){ };
    animatedcollapse.init();

    // Login box popup
    $('.facebox-link').facebox({
        closeImage: '/assets/images/control-login-toggle.gif'
    });
    $(document).bind('reveal.facebox', function() { 
        Cufon.replace("h2", {hover: true});
    });

    // Back to top button
    $('#to-top a').click(function(){
        $('html, body').animate({scrollTop: '0px'}, 300);
        return false;
    });

    // FAQ expand/collapse

    SSS_faq = {
        init : function() {
            $('div.faq .answer').not(':first').slideToggle('fast');
            $('div.faq .question').click(function() { SSS_faq.toggle(this) });
        },

        toggle : function(elt) {
            $(elt).toggleClass('active');
            $(elt).siblings('.answer').slideToggle('fast');
        }
    }

    $(function() { 
        SSS_faq.init();
    });
});
</code>

In the footer of every page I use Cufon like so
<code>
<!--[if IE]><script type="text/javascript"> Cufon.now(); </script><![endif]-->

请有人知道如何解决这个问题并解决它吗?

谢谢

1 个答案:

答案 0 :(得分:1)

延迟对我来说并不算太糟糕 - 可能与互联网/ PC速度有关。然而,它有点明显。

也许

$('.acc-container').hide();

在开始时,隐藏所有内容,然后将其淡入以查看其余代码何时完成?