【问题标题】:why bootboxjs scroll my page to top?为什么 bootboxjs 将我的页面滚动到顶部?
【发布时间】:2014-03-16 02:47:13
【问题描述】:

我使用按钮和 div,但在所有情况下,bootbox.js 都会将我的页面滚动到顶部。

$("#sampleButton").click(function(){
    bootbox.alert("hey");
});

【问题讨论】:

  • 您在#samplebutton 上使用href="#" 或类似的东西吗?如果是这样,请改用href="javascript:void(0)"
  • @wwarren 不,我没有使用 href 我的 html 代码是
    Client
  • 显示所有代码。 html + js。
  • html 代码:-
    客户端
    & java 脚本:- $("#sampleButton").click (function(){ bootbox.alert("嘿"); });
  • 请创建 jsfiddle 来演示您的问题

标签: jquery twitter-bootstrap bootbox


【解决方案1】:

我使用jquery-impromptu解决了这个问题

【讨论】:

    【解决方案2】:

    尝试使用

    $("#sampleButton").click(function(e){ 
      e.preventDefault();
      bootbox.alert("hey"); 
    });
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-02-16
      • 2023-02-25
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-10-25
      相关资源
      最近更新 更多