Reputation: 295
I know this is something really simple, but I can't figure out to keep the page from jumping to the top when a button is pressed. I'm using some jquery to make pictures fade in and out when a button is pressed, but it makes the page jump up to the top!
I'm also using twitter bootstrap
Please view the source here and see if you can find what's wrong I'd really appreciate it!
edit: forgot the source!!!
http://schechterbusiness.info/
Upvotes: 0
Views: 171
Reputation: 1
I had a similar issue and found that it disappeared by changing the button type: In Chrome at least type="submit" seems to reset the whole page when pressed whereas type="button" does not.
Upvotes: 0
Reputation: 16923
click me!
buttons doesn't work and brings you to top as there is no events for themid="fryLink"
, id="benderLink"
attributes to buttons, not div'sEdit:
I see now buttons are working, but page jumps to top so what you have to do is replace:
...').click(function() {
to:
...').click(function(e) {
e.preventDefault();
And add container for img like:
<div id="container">
<img id="img" src="" />
</div>
<style> #container { height: 300px; } </style>
Upvotes: 1