jQuery plugin - TouchSwipe - doesn't work on the first load


#1

Once the page loads for the first time, the jQuery plugin which is actually an Atmosphere package ( hedcet:touch-swipe ) doesn’t work.

One the loads after that in the same tab - weirdly? - and also regardless of the route and template we are running on this layout, it perfectly works!

Snippet:

Template.layout.onRendered(function () {
    //...some code
    $(window).swipe({
        swipe: function (event, direction) {
            if (direction == 'left') {
                drawer.open = true
            } else if (direction == 'right') {
                drawer.open = false
            }
        }
    });
    //some other code...
})