模拟按钮点击时,我的Jquery代码不会触发功能。
HTML:
<section id="latz-secondItem">
<button type="button" data-role="none" class="slick-prev" style="display:
block;">Previous</button>
<button type="button" data-role="none" class="slick-next" style="display:
block;">Next</button>
</section>
Jquery的:
/* link directly to the 2nd slide */
var hashTag = window.location.hash;
if (hashTag != '' && hashTag == '#latz-secondItem') {
setTimeout(function(){
$('html, body').animate({
'scrollTop': $('#latz-secondItem').offset().top
}, 2000);
},2000);
$('#latz-secondItem .slick-next').trigger('click');
}
答案 0 :(得分:0)
为此次点击事件注册回调
$(function(){
$(".slick-next").on("click", function(){
// code to be executed on click
})
})