zippy1978/jquery.scrollz

Allow scrollz to work properly with jQuery Mobile Panel widgets

gabaum10 opened this issue · 0 comments

RIght now, if you try to use the auto-init feature via the data-scrollz="pull" attribute on a jQM page that has a panel, all sorts of craziness ensues. I was able to work around this by initializing it after the panel has been rendered on a specific target inside the panel. The only problem with this is it breaks a whole bunch of built in scrollz functionality. I have to add all sorts of weird hacks like this:

        if(!$('.scrollz-init', view.$el).exists()) {
            view.$scrollContainer.scrollz({
                pull: true,
                emulateTouchEvents: true,
                styleClass: 'scrollz-init'
            });
            // have to hide the header before anything else happens because scrollz doesn't do it by default
            view.$scrollContainer.scrollz('hidePullHeader', false);
            // also because the height calulations don't like the panel, we have to set it manually :(
            view.$scrollContainer.scrollz('height', $(window).height()-97 /*top bar and bottom bar height*/);
        } 

And then you have to add a window.resize listener to update the heights because by setting the height programmatically, it no longer updates automatically. This would be really nice if the plugin just worked when initialized in a panel.