Hey,
i'am new to Javascript and have a question how to handle a click event with url.
<nav>
<div data-foo="target.html">Target</div>
</nav>
$(document).ready(function() {
var tl = new TimelineMax({
onReverseComplete: function() {
window.location = url;
}
});
tl.to("#overlay", 1, {top:"0", delay:0, ease:Power4.easeInOut},0);
tl.to("#menu", 1, {opacity:"1", delay:0, ease:Power4.easeInOut},1);
tl.play();
$("nav").on( "click", function() {
url = $(this).data("foo");
// used a data-value to store the anchor like index.html
tl.reverse();
});
});
But how to do this with a correct a href and prevent Default ?
<nav>
<a href="target.html">Target</a>
</nav>
Thank you very much.