jblas / jquery-mobile-plugins Goto Github PK
View Code? Open in Web Editor NEWVarious Plugins to Enhance jQuery Mobile
Various Plugins to Enhance jQuery Mobile
As of 1.6.0, it'll not be triggered anymore
Problem is when you try to bookmark a page with a query string value the system ignores the query string and just loads the initial page, ie:
someurl.com/#myPage?id=123
So I've come up with a work around that seems pretty solid with some basic testing so far, just wanted to share this and get feedback to see what thoughts are. Since it requires binding to the mobileinit event, it needs to be in a separate script before the jquery mobile include:
<script src="http://code.jquery.com/jquery-1.8.2.min.js"></script>
<script type="text/javascript">
var _forceChange = null;
$(document).bind("mobileinit", function (e, data) {
var checkRoute = location.hash;
if (checkRoute.indexOf('#') > -1 && checkRoute.indexOf('?') > -1)
_forceChange = checkRoute;
});
$(document).bind("pagebeforechange", function (e, data) {
if (_forceChange) {
var redirect = _forceChange;
_forceChange = null;
$.mobile.changePage(redirect);
e.preventDefault();
}
});
</script>
<script src="http://code.jquery.com/mobile/1.2.0/jquery.mobile-1.2.0.min.js"></script>
<script type="text/javascript" src="scripts/jqm.page.params.js"></script>
I've noticed that the plugin binds to pagebeforechange - this means that page changes initiated from a jQM control or via $.mobile.changePage()
work fine, but a direct page refresh / load using query string params will not work.
For example, say I have a page:
http://domain.com/index.html#lobby?user=1234
The following will work fine:
$.mobile.changePage('#lobby?user=1234')
But trying to bookmark / refresh the page, as the pagebeforechange
event never fires on initial page load, the plugin can't parse the query string.
Perhaps a quick/easy fix would be to bind to both pagebeforecreate
and pagebeforechange
, to catch both cases?
I used this page-param but it doesn't work.
when I visit "#shop?id=100", the URL is supposed to be "#shop" and with "id=100" stored in data. However, browser shows that URL is still "#shop?id=100" and the query string is not stored in data.
I tried to figure out if there's anything wrong, and I found that:
when changePage() is called, if the URL is string, it will call loadPage(). BUT, when loadPage() sees there are data in settings.data, it will reconstruct the URL by adding the query string back, which is just a reverse operation of this plugin
I am using jquery mobile 1.1.0-rc.1. I'm not sure if I was right about this. Please help to take a look and reply. Thanks :-)
I've just updated my app to jQM 1.3.0 rc1 and page-params plugin doesn't work anymore: no params in queryString, so backbuttons have unexpected results
Whilst the plugin works fine for multipage templates I cannot get it to work for single page templates (where you have an individual html file for each page). Since there is no readme or support details I though I'd ask here?
This plugin has been great for me, but it doesn't work with jqm 1.3.0.
Please fix :)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.