javascript - Redirect to hash url using Jquery -
i've seen site redirection within delay/time limit possible within page has hash urls?
what code redirecting hash location within page? instance in #home when click on #load, waits 5 seconds redirects #about - within 1 page different hashes/#.
thank you!
well, if click on anchor associated hash (would curious, understood), first have prevent defautl behavior, can redirect.
assumed html
<a href="#load">some link</a> js (once document ready)
$('a[href="#load"]').click(function (e) { e.preventdefault(); settimeout(function () { window.location.hash = 'about'; }, 5000); }); edit: "going #load automatically redirect delay of 5 seconds without clicking"
$(window).on('hashchange', function () { if (window.location.hash == '#load') { settimeout(function () { window.location.hash = 'about'; }, 5000); } }); javascript jquery url redirect hash
No comments:
Post a Comment