所以我有一个目录部分,我想在悬停过程中打开和关闭它。问题是我需要单击该目录中的链接两次才能使其转到正确的部分。锚标签中所有对应的ID都可以。这是一个wordpress网站。浏览器 Chrome。
可能是脚本干扰了,我该如何纠正?
这是我使用的 javascript:
(function( $ ) {
$( '.tableofcontents' ).hover(function() {
$( this ).children( 'h5' ).trigger( 'click' );
});
})( jQuery );
答案 0 :(得分:0)
尝试将“悬停”功能更改为“鼠标输入”
$( '.tableofcontents' ).on('mouseenter', function() {
$( this ).children( 'h5' ).trigger( 'click' );
});