Internet Explorer 11 Dots (calling Goto function dont work)
Closed this issue · 1 comments
Hello friend
Im trying to add your Dots(pagination) and Previous/Next(arrows), i made it work,
Until i tested with Internet Explorer 11... :(
First i needed to change the (Previos / Next) system from this....
//document.querySelector('.siema-prev').addEventListener('click', () => mySiema1.prev());
//document.querySelector('.siema-next').addEventListener('click', () => mySiema1.next());
To this
document.querySelector('.siema-prev').addEventListener('click', function () {mySiema1.prev()});
document.querySelector('.siema-next').addEventListener('click', function () {mySiema1.next()});
() => mySiema1.prev() became: ### function () {mySiema1.next()}
And now works...
But now im trying to use the Goto function at Dots "system", but it dont work on Internet Explorer 11, can you help me?
PS: i changed a little, using Spans, and putted inside a div a created: "siema-pagination"
Siema.prototype.addPag = function() {
this.dots = document.createElement('div');
this.dots.classList.add('siema-pagination');
for(let i = 0; i < this.innerElements.length; i++) {
const dot = document.createElement('span');
dot.addEventListener('click', () => {
this.goTo(i);
})
this.dots.appendChild(dot);
}
this.selector.parentNode.insertBefore(this.dots, this.selector.nextSibling);
}
The part:
dot.addEventListener('click', () => {
this.goTo(i);
})
Dont Work on IE11, just like the first issue, but i tried the same workaround and didnt help
dot.addEventListener('click', () => { this.goTo(i);} )
to
dot.addEventListener('click', function () { this.goTo(i);} )
EDIT: on Internet Explorer 11 , the "i" variable, returns to this.goTo(i) always 0
So all Dots sends to first page
It seems to be related with limited support for ES2015 features on IE11. Try to convert all let
and const
to var. In this cace it should be the solution.
Thanks for using Siema and have a great day 👋