MagicMirror² v2.14.0 is available! For more information about this release, check out this topic.

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
    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.

    Notices that if you uncomment the lines from 92-113, then the swiper is applied correctly.

    But for some reason it doesnt work when i apply the same coding to the rest of the getDom function…

Log in to reply