Hey guys,
I have a script here that sets an interval and goes to an anchor. However, it switches instantly and not smoothly.
How can I make this work?
[CODE]<script>
var myVar = setInterval(function(){myTimer()}, 1000);
function myTimer() {
window.location.hash=” The anchor “;
clearInterval(myVar);
}
</script>
I have found a script that works on a class and has a click event. This one slides smoothly to the anchor. I’ve tried to
somehow combine them but so far no luck.
[CODE]<script type=’text/javascript’>
jQuery(document).ready(function($) {
$(“.scroll”).click(function(event){
event.preventDefault();
$(‘html,body’).animate({scrollTop:$(this.hash).offset().top}, 500);
});
});
</script>
[CODE]<a href=”#nee” class=”scroll”>Link To Anchor</a>
And last but not least; Can I build in an If, Else event. For instance, when the anchor is not found, nothing will happen?
I appreciate your help!