Read the statement by Michael Teeuw here.
Swiper only works on first update...
-
I am trying to add a swiper to the official rss news module, but I am having some problems. Whenever i open the page, the slider only works, the first time the getDom function is called. Once the rss feed is fetched and ready, the getDom function is called again, but this time the swiper doesnt work.
I am using this swiper http://idangero.us/swiper/demos/
and i am initating the swiper by creating a swiper object and passing it the class for the swiper div.// Override dom generator. getDom: function() { if (this.newsItems.length > 0){ var swiper = new Swiper('.swiper-container'); var container = document.createElement("div"); container.className = "swiper-container"; var wrapper = document.createElement("div"); wrapper.className = "swiper-wrapper"; ...... (more code ...... return container;
I cant figure out why the swiper only works the first time the getDom function is called. Any suggestions?
-
If anybody would be interested in trying to help solving it, then here is a link.
https://github.com/mortenbirkelund/MMMT-Newsfeed
Notices that if you uncomment the lines from 92-113, then the swiper is applied correctly.
https://github.com/mortenbirkelund/MMMT-Newsfeed/blob/master/MMMT-Newsfeed.jsBut for some reason it doesnt work when i apply the same coding to the rest of the getDom function…