问题描述
我要问的一个问题是Smit Raval在……Link to anchor and open accordion上已经回答了这个已经得到最好回答的问题,他的回答非常适合从外部链接打开手风琴。但是,一旦打开该手风琴,我希望浏览器的URL以末尾的#anchor更新,因此现在有人可以使用锚链接将其添加为书签。因此,这是到目前为止的我的最终代码...感激不尽。
<script type="text/javascript">
(function($) {
$('.expand').click(function() {
$('.expand').removeClass('currentOn');
$('.collapse').slideUp('normal');
if($(this).next().is(':hidden') == true) {
$(this).addClass('currentOn');
$(this).next().slideDown('normal');
}
});
$('.expand').mouSEOver(function() {
$(this).addClass('over');
}).mouSEOut(function() {
$(this).removeClass('over');
});
$('.collapse').hide();
$('.open').slideDown('normal');
})( jQuery );
</script>
<!--This script is for linking from an external page and to open the accordion by ID-->
<script type="text/javascript">
(function($) {
$(document).ready(function(){
var hash = window.location.hash;
if (hash) {
var element = $(hash);
if (element.length) {
element.trigger('click');
$(window).scrollTop($accordionSection.offset().top);
}
}
});
})( jQuery );
</script>
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)