jquery - Keep certain links in standalone mode on iPhone -


i've found gist prevents links webpages go outside "standalone mode" on iphone, i'd disable functionality on links classes.

whenever modal present, functionality breaks , quick opens modal , redirects href.

the code:

    if(("standalone" in window.navigator) && window.navigator.standalone) {       var noddy, remotes = false;       document.addeventlistener('click', function(event) {         noddy = event.target;         while(noddy.nodename !== "a" && noddy.nodename !== "html") {               noddy = noddy.parentnode;           }         if('href' in noddy && noddy.href.indexof('http') !== -1 && (noddy.href.indexof(document.location.host) !== -1 || remotes)) {           event.preventdefault();           document.location.href = noddy.href;         }       }, false);     } 

how can modify include a classes, such open, modal shouldn't use above functionality , keep modal open?

try this.

if(("standalone" in window.navigator) && window.navigator.standalone) {   var noddy, remotes = false;   document.addeventlistener('click', function(event) {     noddy = event.target;     var classname = noddy.classname;     if(noddy.nodename === "a"          && (classname.indexof('open') != -1 || classname.indexof('modal') != -1)){          return;//just return without doing     }      while(noddy.nodename !== "a" && noddy.nodename !== "html") {           noddy = noddy.parentnode;       }     if('href' in noddy && noddy.href.indexof('http') !== -1 && (noddy.href.indexof(document.location.host) !== -1 || remotes)) {       event.preventdefault();       document.location.href = noddy.href;     }   }, false); } 

as side note if using jquery in page or application code can reduced using jquery built in apis.


Comments

Popular posts from this blog

jquery - Invalid Assignment Left-Hand Side -

java - Play! framework 2.0: How to display multiple image? -

gmail - Is there any documentation for read-only access to the Google Contacts API? -