2010-09-09 72 views
0

使用自定義jquery創建獨立滑塊和獨立手風琴,並帶有製表符。哪些都有效。但是,如何阻止他們在頁面加載時打開?!?!這發生在所有瀏覽器中,加載需要大約2秒鐘的時間!JQuery垂直滑塊在手風琴,選項卡和Cufon閃爍的頁面加載時打開並閃爍

你需要

  • 用戶名:名單
  • 密碼:列表

我也用FL icker並利用新聞報道,Cufon也會在加載頁面之前閃爍。我使用所有頁面底部的Cufon.now()functin。

該網站目前只是非常基本的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

的延遲是不是對我來說太糟糕了 - 可能是互聯網/ PC的速度有關。但是它稍微顯而易見。

也許

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

在一開始,隱瞞了一切,那麼剛剛褪去它來查看時,其餘代碼完成?

+0

滑塊如何,因爲這是Mac上最差的Firefox 3+ – Solidariti 2010-09-09 11:40:05

+0

加載後我會如何淡入?這是否會加快頁面的加載或隱藏它,以免人們看到它擴大? – Solidariti 2010-12-02 00:23:51