[英]Why is Javascript click event not working
I am trying to replicate this tutorial:我正在尝试复制本教程:
https://tympanus.net/codrops/2016/09/29/transition-effect-with-css-masks/ when I click the arrow it should slide to a different wrapper and init an animation, but for some reason is not working I tried to change and morphe it in Jquery but still not working https://tympanus.net/codrops/2016/09/29/transition-effect-with-css-masks/当我单击箭头时,它应该滑动到不同的包装器并初始化动画,但由于某种原因不起作用我尝试在 Jquery 中对其进行更改和变形,但仍然无法正常工作
function init() {
......
Slider.prototype.events = function () {
var self = this;
this.dom.arrow.on('click', function () {
if (self.working)
return;
self.processBtn($(this));
});
};
.-....
}
what could be possibly be the mistake?什么可能是错误?
try for loop
fifi_slider.prototype.buildDots = function () {
var _ = this;
for (var i = 0; i < _.totalSlides; i++) {
var dot = document.createElement('li');
dot.setAttribute('data-slide', i + 1);
_.def.dotsWrapper.appendChild(dot);
}
_.def.dotsWrapper.addEventListener('click', function (e) {
if (e.target && e.target.nodeName == "LI") {
_.curSlide = e.target.getAttribute('data-slide');
_.gotoSlide();
}
}, false);
}
You forgot to add a DOT to the arrow selector.您忘记向箭头选择器添加 DOT。
https://codepen.io/besciualex/pen/YzPzGOw?editors=1111 https://codepen.io/besciualex/pen/YzPzGOw?editors=1111
// Previous selector value (without DOT)
this.dom.arrow = this.dom.wrapper.find('arrow');
// Correct selector value (with DOT)
this.dom.arrow = this.dom.wrapper.find('.arrow');
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.