I'm having a problem with jquery carousel data-slide, I've set it to scroll to the content and it works but when you try to scroll up, the page jitters.
I was able to stop it using
e.preventDefault();
But that created other problems in the carousel headers, they stopped moving and changing classes when they become active.
This is my JS
$(".scrolltotab").click(function(e) {
var hre = e.currentTarget.href;
var id = hre.split("#");
id = id[1];
$('html, body').animate({
scrollTop: $("#custom_carousel").offset().top
}, 1000);
})
$('#custom_carousel').on('slide.bs.carousel', function(evt) {
e.preventDefault();
$('html, body').animate({
scrollTop: $("#custom_carousel").offset().top
}, 1000);
$('#custom_carousel .controls li.active').removeClass('active');
$('#custom_carousel .controls li:eq(' + $(evt.relatedTarget).index() + ')').addClass('active');
})
$(".customnum").keydown(function(e) {
// Allow: backspace, delete, tab, escape, enter and .
if ($.inArray(e.keyCode, [46, 8, 9, 27, 13, 110, 190]) !== -1 ||
// Allow: Ctrl+A, Command+A
(e.keyCode == 65 && (e.ctrlKey === true || e.metaKey === true)) ||
// Allow: home, end, left, right, down, up
(e.keyCode >= 35 && e.keyCode <= 40)) {
// let it happen, don't do anything
return;
}
// Ensure that it is a number and stop the keypress
if ((e.shiftKey || (e.keyCode < 48 || e.keyCode > 57)) && (e.keyCode < 96 || e.keyCode > 105)) {
e.preventDefault();
}
});