Reputation: 13853
I have a tab pane that is inside a fixed size div, whenever that tab is switched to one that is larger than the outer div the entire page is scrolling down such that I cannot see my tabs anymore, I've mocked it up in jsfiddle to show the problem.
Note that in order to see the problem the page must be smaller than the containing div.
Anyone know how I can stop the page from scrolling down when the tabs switch without using javascript?
Upvotes: 3
Views: 4135
Reputation: 5769
If you want to use „pure” JavaScript, use:
function stopScroll()
{
document.getElementById("body_id").style.overflow = "hidden";
}
function startScroll()
{
document.getElementById("body_id").style.overflow = "auto";
}
Upvotes: 0
Reputation: 13853
Thanks for showing me the evt.preventDefault() It got me to look in the right spot. The link when clicked points to my hidden div which the page then scrolls down to.
To stop the scrolling I can also just remove the id from the href attribute to something else,
Upvotes: 1
Reputation: 12730
Without using JavaScript? Cannot be done.
Using JavaScript it's easy:
evt.preventDefault();
Upvotes: 0