javascript - Redirect page and auto-open some lightbox -
i have address: www.example.com/teste123
on page have redirect:
<% response.redirect "http://www.example.com/index.asp?teste=true" %>
so want? want if user access these address www.example.com/teste123, , page redirect root of website, open lightbox file inside...
i found script variable on url:
function geturlvars(){ var vars = [], hash; var hashes = window.location.href.slice(window.location.href.indexof('?') + 1).split('&'); for(var = 0; < hashes.length; i++) { hash = hashes[i].split('='); vars.push(hash[0]); vars[hash[0]] = hash[1]; } return vars; } var xxx = geturlvars()["teste"];
these return me true
.. right... but.. how open lightbox if var xxx
equal "true" ?
there lots of tutorials on lightboxes can google , pick from. basic logic (assuming you're using jquery):
<div class="my_light_box" style="display:none;">hi.</div> <script> if(geturlvars()["test"]) { $('.my_light_box').show(); } function geturlvars(){ var vars = [], hash; var hashes = window.location.href.slice(window.location.href.indexof('?') + 1).split('&'); for(var = 0; < hashes.length; i++) { hash = hashes[i].split('='); vars.push(hash[0]); vars[hash[0]] = hash[1]; } return vars; } </script>
Comments
Post a Comment