Jquery 如何自动打开";“手风琴”;第一选择?
我买了一个好像是手风琴的模板(可能是定制的吧?),我正试图让第一页(手风琴幻灯片)自动打开 他是代码:Jquery 如何自动打开";“手风琴”;第一选择?,jquery,jquery-selectors,Jquery,Jquery Selectors,我买了一个好像是手风琴的模板(可能是定制的吧?),我正试图让第一页(手风琴幻灯片)自动打开 他是代码: Cufon.now(); $(window).load(function(){ $('#content>dd').css({display:'block'}) $('#thumbs').jScrollPane({ showArrows:false, scrollbarWidth:28, dragMaxHeight:82
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,所以不是一个完全的新手,但很容易:)
非常感谢 您可以通过编程方式单击“主”标题来实现:
// this will trigger a 'click' event on the first element (which is the "MAIN")
$('#content dt:first a').trigger('click');
将这一行添加到脚本的末尾,在最后一个}之前代码>
有关的更多信息:
如果看不到实际页面,就很难猜到该做什么。你没有模板的链接吗?当然,很抱歉没有。我只希望当人们访问网站时,主区域是开放的。你是一个英雄!谢谢。如果有人在这条线上寻找帮助…我必须做一个调整。。我把它放在脚本结束之前,所有的菜单选项都会在加载时滑动,但没有打开。我把它移到了window.load函数的末尾,它就像一个符咒!我真是太感谢你了!很高兴它有帮助!你可以投票并接受答案;-)