[英]Only open accordion once, but still call onclick each time, when button clicked in jquery
I am using jquery accordion animation: 我正在使用jQuery手风琴动画:
$('.accordion').click(function() {
$(this).next().toggle("fold", 1000);
return false;
}).next().hide();
along with a button for expanding the div below: 以及用于扩展以下div的按钮:
<button class="accordion" onclick="my_method()">EXPAND</button>
<div class="panel">
...contents to expand here
</div>
This works great. 这很好。 But I only want to allow the accordion to open once (unless page refreshed obviously), although the onclick event should call the method every time the button is clicked. 但是我只想让手风琴打开一次(除非明显刷新了页面),尽管每次单击按钮时onclick事件都应该调用该方法。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.