jquery mobile - JQuerymobile redirect on pageshow with delay -
i working on jquerymobile site multiple pages. if 1 of pages shown (id="shown"), want redirect page (id=#redirected") after delay of 6 seconds.
in code, commented line works this, problem redirects #redirected page if user changes sup page in meantime. need "if other page not shown" thing in here.
i tried jquery "changepage" (which handle transitions etc.), don't know how implement delay here.
please see code:
$("#shown").bind("pageshow", function(e) { //window.settimeout('window.location="#redirected"; ',6000); $.mobile.changepage("#fertig", { reverse: "false"});
i made working jsfiddle you: http://jsfiddle.net/zuzmx/
using jquery mobile multi-page template 3 pages ids "one", "two", , "three". when navigating 2 initiates timeout of 6 seconds after checks if active page "two" and, if so, proceeds redirect user 3 using mobile changepage (so can make full use of transitions).
javascript used:
$(document).delegate("#two", "pageshow", function(event) { settimeout(function() { if($.mobile.activepage.attr("id") == "two") { $.mobile.changepage("#three", { transition: "slide" }); } }, 6000);}); if understood case correctly "two" changed "shown" , "three" "redirected".
Comments
Post a Comment