Javascript 触发器onClick();页面加载
我想在页面完全加载后自动执行$(“.rope”)。单击()函数Javascript 触发器onClick();页面加载,javascript,jquery,Javascript,Jquery,我想在页面完全加载后自动执行$(“.rope”)。单击()函数 <script type="text/javascript"> $(document).ready(function() { $curtainopen = false; $(".rope").click(function(){ $(this).blur(); if ($curtainopen == false){
<script type="text/javascript">
$(document).ready(function() {
$curtainopen = false;
$(".rope").click(function(){
$(this).blur();
if ($curtainopen == false){
$(this).stop().animate({top: '0px' }, {queue:false, duration:350, easing:'easeOutBounce'});
$(".leftcurtain").stop().animate({width:'60px'}, 4500 );
$(".rightcurtain").stop().animate({width:'60px'},4500 );
$curtainopen = true;
}else{
$(this).stop().animate({top: '-40px' }, {queue:false, duration:350, easing:'easeOutBounce'});
$(".leftcurtain").stop().animate({width:'50%'}, 4500 );
$(".rightcurtain").stop().animate({width:'51%'},4500 );
$curtainopen = false;
}
return false;
});
});
</script>
$(文档).ready(函数(){
$curtainopen=false;
$(“.rope”)。单击(函数(){
$(this.blur();
如果($curtainopen==false){
$(this.stop().animate({top:'0px'},{queue:false,duration:350,easeOutBounce'});
$(“.left窗帘”).stop().animate({width:'60px'},4500);
$(“.Right窗帘”).stop().animate({width:'60px'},4500);
$curtainopen=true;
}否则{
$(this.stop().animate({top:'-40px'},{queue:false,duration:350,easeOutBounce'});
$(“.left窗帘”).stop().animate({width:'50%”,4500);
$(“.Right窗帘”).stop().animate({width:'51%},4500);
$curtainopen=false;
}
返回false;
});
});
请提供帮助。您可以在您的侦听器定义之后编写以下内容:
$(".rope").click()
或
您可以在侦听器定义之后编写:
$(".rope").click()
或
您可以在侦听器定义之后编写:
$(".rope").click()
或
您可以在侦听器定义之后编写:
$(".rope").click()
或
在dom ready with selector中使用.click()
或.trigger('click')
:
$(".rope").click();
//or
$(".rope").trigger('click');
在dom ready with selector中使用.click()
或.trigger('click')
:
$(".rope").click();
//or
$(".rope").trigger('click');
在dom ready with selector中使用.click()
或.trigger('click')
:
$(".rope").click();
//or
$(".rope").trigger('click');
在dom ready with selector中使用.click()
或.trigger('click')
:
$(".rope").click();
//or
$(".rope").trigger('click');
我想把它锁在后面:
$(".rope").click(function(){
$(this).blur();
if ($curtainopen == false){
$(this).stop().animate({top: '0px' }, {queue:false, duration:350, easing:'easeOutBounce'});
$(".leftcurtain").stop().animate({width:'60px'}, 4500 );
$(".rightcurtain").stop().animate({width:'60px'},4500 );
$curtainopen = true;
}else{
$(this).stop().animate({top: '-40px' }, {queue:false, duration:350, easing:'easeOutBounce'});
$(".leftcurtain").stop().animate({width:'50%'}, 4500 );
$(".rightcurtain").stop().animate({width:'51%'},4500 );
$curtainopen = false;
}
return false;
}).click();
我想把它锁在后面:
$(".rope").click(function(){
$(this).blur();
if ($curtainopen == false){
$(this).stop().animate({top: '0px' }, {queue:false, duration:350, easing:'easeOutBounce'});
$(".leftcurtain").stop().animate({width:'60px'}, 4500 );
$(".rightcurtain").stop().animate({width:'60px'},4500 );
$curtainopen = true;
}else{
$(this).stop().animate({top: '-40px' }, {queue:false, duration:350, easing:'easeOutBounce'});
$(".leftcurtain").stop().animate({width:'50%'}, 4500 );
$(".rightcurtain").stop().animate({width:'51%'},4500 );
$curtainopen = false;
}
return false;
}).click();
我想把它锁在后面:
$(".rope").click(function(){
$(this).blur();
if ($curtainopen == false){
$(this).stop().animate({top: '0px' }, {queue:false, duration:350, easing:'easeOutBounce'});
$(".leftcurtain").stop().animate({width:'60px'}, 4500 );
$(".rightcurtain").stop().animate({width:'60px'},4500 );
$curtainopen = true;
}else{
$(this).stop().animate({top: '-40px' }, {queue:false, duration:350, easing:'easeOutBounce'});
$(".leftcurtain").stop().animate({width:'50%'}, 4500 );
$(".rightcurtain").stop().animate({width:'51%'},4500 );
$curtainopen = false;
}
return false;
}).click();
我想把它锁在后面:
$(".rope").click(function(){
$(this).blur();
if ($curtainopen == false){
$(this).stop().animate({top: '0px' }, {queue:false, duration:350, easing:'easeOutBounce'});
$(".leftcurtain").stop().animate({width:'60px'}, 4500 );
$(".rightcurtain").stop().animate({width:'60px'},4500 );
$curtainopen = true;
}else{
$(this).stop().animate({top: '-40px' }, {queue:false, duration:350, easing:'easeOutBounce'});
$(".leftcurtain").stop().animate({width:'50%'}, 4500 );
$(".rightcurtain").stop().animate({width:'51%'},4500 );
$curtainopen = false;
}
return false;
}).click();
我不会对每个答案都发表评论,而是在这里告诉你:
。trigger('click')
比快。click()
。我不会对每个答案发表评论,而是在这里告诉你:。trigger('click')
比快。click()
。我不会对每个答案发表评论,而是在这里告诉你:。trigger('click'))
比快。click()
。我在这里告诉您:。trigger('click')
比快。click()
。