我知道这很简单,但我无法弄清楚当按下按钮时页面不会跳到顶部。我正在使用一些 jquery 在按下按钮时使图片淡入和淡出,但这会使页面跳到顶部!
我也在使用 twitter 引导程序
请在此处查看源代码,看看您是否能找到问题所在,我将不胜感激!
编辑:忘记来源!!!
我知道这很简单,但我无法弄清楚当按下按钮时页面不会跳到顶部。我正在使用一些 jquery 在按下按钮时使图片淡入和淡出,但这会使页面跳到顶部!
我也在使用 twitter 引导程序
请在此处查看源代码,看看您是否能找到问题所在,我将不胜感激!
编辑:忘记来源!!!
click me!
按钮不起作用并将您带到顶部,因为它们没有事件id="fryLink"
divid="benderLink"
编辑:
我现在看到按钮正在工作,但页面跳转到顶部,所以你需要做的是替换:
...').click(function() {
到:
...').click(function(e) {
e.preventDefault();
并为 img 添加容器,例如:
<div id="container">
<img id="img" src="" />
</div>
<style> #container { height: 300px; } </style>
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.