I can't seem to get preventDefault() to work with the following code... The browser still wants to jump to the top of the page after a click. Any ideas on how to fix this?
$('#controls a').click(function(event){
event.preventDefault();
var r = $(this).attr('rel');
var c = $('#container').attr('class');
// Prevent redundant actions
if (r != c) {
// Toggle 'active' class to show selection
$('#controls a').removeClass('active');
$(this).addClass('active');
// Fade out function then callback to change the view mode
$('#container').fadeOut(100, function(){
$('#container').removeAttr('class');
$('#container').addClass(r);
// Fade the container back in
$('#container').fadeIn(100);
});
}
}); //end list view