2012-01-22 21 views
2

私はアコーデオン(カスタムかもしれませんか?)と思われるテンプレートを購入し、最初のページ(アコーディオンスライド)を自動的に開こうとしています。「アコーディオン」を最初の選択に自動的に開く方法は?

彼はコードです:

Cufon.now(); 
$(window).load(function(){ 

    $('#content>dd').css({display:'block'}) 


    $('#thumbs').jScrollPane({ 
     showArrows:false, 
     scrollbarWidth:28, 
     dragMaxHeight:82 
    }) 

    $('#thumbs li a').live('click',function(){ 
     $('#pic').attr('src',$(this).attr('href')).bind('load',function(){ 
      $(this).css({opacity:0}).stop().animate({opacity:1}) 
     }) 
     return false 
    }).each(function(){ 
     var tmp=new Image() 
     tmp.src=this.href 
    }) 

    $('#content>dd').css({display:'none'}) 
}) 

$(function(){ 
    $('#content:not(.nav_block)>dt:not(.active) a,footer .privacy:not(.active) a[rel=privacy],a[rel=nav]').live('click',function(){ 
     var next=this.rel=='privacy'?$('#privacy'):this.rel=='nav'?$(this.href.slice(this.href.indexOf('#'))):$(this).parent().next(), 
      width=next.width(), 
      parent=next.parent(), 
      visible=parent.find('>dd:visible').css({overflow:'hidden'}) 
     parent.addClass('nav_block') 
     $('#content>dt,.privacy').removeClass('active') 
     $(this).parent().addClass('active') 
     if(this.rel=='privacy'||this.rel=='nav')$('#content>dt>a').removeClass('active').animate({opacity:0}) 
     if(parent.css('left')!=0) 
      next.parent().animate({left:0}) 
     next.show().css({width:'64px'}).stop().animate({width:width+'px'},{ 
      step:visible.length?function(now){ 
      visible.width(width-now) 
     }:'',complete:function(){ 
      next.css({overflow:'visible'}) 
      visible.css({width:width+'px'}).hide() 
      parent.removeClass('nav_block') 
     }}) 
     return false 
    }) 

    $('.active a,#content.nav_block').live('click',function(){ 
     return false 
    }) 

    var imgs=[] 
    $('#page1 img').each(function(){ 
     imgs.push(this) 
    }) 
    $(imgs[0]).siblings('img').css({opacity:0}) 

    $('#page1 a.prev,#page1 a.next').css({opacity:0}).live('click',function(){ 
     var img,pr=$(imgs[0]) 
     if($(this).hasClass('next')) 
      imgs.push(imgs.shift()) 
     else 
      imgs.unshift(imgs.pop()) 
     img=$(imgs[0]).show() 
     img.animate({opacity:1},{step:function(now){ 
      pr.css({opacity:1-now}) 
     }}) 
     return false 
    }) 

    $('#page1 .inner') 
     .live('mouseover',function(){$('a.prev,a.next',this).stop().animate({opacity:1})}) 
     .live('mouseout',function(){$('a.prev,a.next',this).stop().animate({opacity:0})}) 

    $('#content>dt>a:not(.active)').css({opacity:0}) 
    .live('mouseover',function(){ 
     $(this).stop().animate({opacity:1}) 
    }) 
    .live('mouseout',function(){ 
     $(this).stop().animate({opacity:0}) 
    }) 
    .live('click',function(){ 
     $(this).addClass('active').parent().siblings().find('>a').removeClass('active').stop().animate({opacity:0}) 
    }) 
}) 

すべてのヘルプは高く評価され(私はそれがカスタムアコーディオンか何かだと思う理由は)、私は無限のスレッドとすべてを見ている動作しませんでしたソリューションを提供しています。私はjQueryのエントリレベルです、私は基本的なJava、VB、Objective Cを知っていますので、完全な初心者ではありません:)簡単に行く:)

ありがとうございます!

+0

それが何をすべきかを推測することはかなり困難です。テンプレートのどこかにリンクがありませんか? –

+0

絶対に、残して申し訳ありません。 http://thebuzzformen.com/人がサイトにアクセスしたときにMAINエリアを開いておきたいだけです。 – synergy989

答えて

1

あなたは、プログラム「MAIN」ヘッダをクリックを発行することによって、それを達成することができます

// this will trigger a 'click' event on the first element (which is the "MAIN") 
$('#content dt:first a').trigger('click'); 

が最後});前に、スクリプトの末尾に次の行を追加します。上

詳細情報:実際のページを見ずに

+0

あなたは英雄です!どうもありがとう。もし誰かがこのスレッドに助けを求めたら...私はちょっと微調整しなければならなかった。私はスクリプトの最後の前にそれを置いた。すべてのメニューオプションは読み込み時にスライドするが開きませんでした。私はwindow.load関数の最後に移動し、それは魅力のように動作します!私は十分にあなたに感謝できません! – synergy989

+0

うれしかったよ!あなたはupvoteして、その答えを受け入れることができます;-) –

関連する問題