JQuery Mobile strange behavior, select's onchange event goes back all the time (only on SAFARI IPHONE) -
JQuery Mobile strange behavior, select's onchange event goes back all the time (only on SAFARI IPHONE) -
i've developed dynamic website local paper in hellenic republic , have next unusual behavior on mobile edition (jquery mobile):
i have select on top of every page categories (top right) , when select there category, grab onchange event , take value of alternative contains destination url. page changed goes original (caller) page.
i have within page list view same urls top select (categories) , if click on links (from list view) everythings goes fine.
3. behavior can reproduced iphone safari browser.
i read answers more or less same problem, workaround has worked me. url of mobile version is: http://m.stagonnews.gr
thanks.
do not utilize $(document).ready() function!
jquery mobile docs offer documentation this! fires everytime alter page , because poping dialog doesn't record history can redirect it, probably. doc here
use live initalization on select field, similar this:
//on pages have div data-role="header" | assign id //if doesn't work, assign live eventto page id, not header id $('#your_header_id').live('pageshow',function (event) { //or 'pagecreate' //load function , fire changing event when user changes select $('select[name=select-choice-a]').change(function(event){ //make sure returns exact value of select //if not, there problem in select value method console.log('change page: #' + this.options[this.selectedindex].value); //to alter page method changes page //you $.mobile.loadpage method insert dom before alter $.mobile.changepage('#' + this.options[this.selectedindex].value,{changehash: false}) }) });
my sentiment using anchors (#element_id's) mobile app developed jquery mobile this: dont!, opinion! utilize specific html files , point link them! pass parameter page , retrieve it, utilize specific function returns me parameter , cool nice stuff it. posted on question here function , how can utilize it. alter pages $.mobile.changepage('mypage.html?id=' + variable).
i utilize method because can construction app limited of info , can controll of html files 1 javascript file, .live events.
a short brief:
index.html <- load javascripts/css/whatever here other_file.html <- declare <html><head></head><body> jqm specific div's here (like <div data-role"page"></div> etc,)</body></html>
jquery iphone select mobile behavior
Comments
Post a Comment