Bootstrap TabPanel Tab - Disable Page Scrolling To Element's ID
You can use
<a data-target="#home">
instead of <a href="#home">
See here for an example: http://jsfiddle.net/RPSmedia/K9LpL/1154/
I fixed this by adding e.stopImmediatePropagation(); to the event handler:
$('.nav-tabs li a').click(function(e){
e.preventDefault();
e.stopImmediatePropagation();
$(this).tab('show');
});
edit: fixed class selector as per comment.
EDIT - Roman's answer below is a better solution than this one.
Using preventDefault()
you can add code to manually toggle the checkboxes.
var checked = $(this).find('input').prop('checked');
$(this).find('input').prop('checked', !checked);
Updated Fiddle
Edit:
I decided to approach this the other way. Do not use preventDefault()
and instead, fix the scrolling issue. I was able to do this with $(window).scrollTop(0)
and a very, very small delay/timeout.
$('#myTab a').click(function (e) {
var scrollHeight = $(document).scrollTop();
$(this).tab('show');
setTimeout(function() {
$(window).scrollTop(scrollHeight );
}, 5);
});
Demo