jakiestfu / Snap.js

A Library for creating beautiful mobile shelfs in Javascript (Facebook and Path style side menus)
http://jakiestfu.github.io/Snap.js/
5.99k stars 663 forks source link

Changing element #188

Closed th0th closed 10 years ago

th0th commented 10 years ago

I am trying to use Snap.js in my project that is built with jQuery Mobile.

For those who are not familiar with jQuery mobile's HTML structure, jQuery mobile body tag consists of multiple pages (defined by data-role="page" attribute) in a single file and switching from one page to another page is done by simple linking (like Something).

The problem is, if i attach snapper to one of the pages it doesn't appear when I navigate to other pages. Wrapping all pages by another element is not an option since it messes with jQuery mobile options.

I am thinking that, hooking a function to jQuery Mobile's 'pagechange' event, and re-initiating snapper every time page is changed. But this doesn't seem to be the best solution. Do you have any suggestions?

gercheq commented 10 years ago

Ditch jQueryMobile and use Snap.js with Bootstrap and Backbone.

On Wednesday, April 9, 2014, H.Gökhan Sarı notifications@github.com wrote:

I am trying to use Snap.js in my project that is built with jQuery Mobile.

For those who are not familiar with jQuery mobile's HTML structure, jQuery mobile body tag consists of multiple pages (defined by data-role="page" attribute) in a single file and switching from one page to another page is done by simple linking (like Something <#14548f8213cd817f_page-main>).

The problem is, if i attach snapper to one of the pages it doesn't appear when I navigate to other pages. Wrapping all pages by another element is not an option since it messes with jQuery mobile options.

I am thinking that, hooking a function to jQuery Mobile's 'pagechange' event, and re-initiating snapper every time page is changed. But this doesn't seem to be the best solution. Do you have any suggestions?

— Reply to this email directly or view it on GitHubhttps://github.com/jakiestfu/Snap.js/issues/188 .

-- Gerçek

th0th commented 10 years ago

I solved my problem re-instantiating a new snapper with the new active page when the page is changed.