2012-01-22 37 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/我只想让主要区域在人们访问该网站时打开。 – synergy989

回答

1

您可以通过在“主”头发出点击编程实现这一目标:

// 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并接受答案,然后;-) –

相关问题