I have a javascript (jquery) snippet that is link to a href="#" to toggle the click.. everything is fine exept when i click around the page is going back all scrooled up... i prefer the page to stay where it is... return false done nothing...
here is the code :
<script type="text/javascript">
jQuery(document).ready(function(){
jQuery('#social li').click(function(){
button = jQuery(this).attr('class');
switch (button)
{
case 'social1' :
jQuery('#facebookbox').show();
jQuery('#twitterbox').hide();
jQuery('.social1 a').addClass('selected');
jQuery('.social2 a').removeClass('selected');
break;
case 'social2' :
jQuery('#facebookbox').hide();
jQuery('#twitterbox').show();
jQuery('.social2 a').addClass('selected');
jQuery('.social1 a').removeClass('selected');
break;
}
});
});
</script>
href="#"links to the top of the page, so naturally, it scrolls the page all the way up. However, returningfalsefrom the onclick handler should prevent the browser from actually following the link. Maybe post some code?