【问题标题】:Load jquery function and progress bar on button click在按钮单击时加载 jquery 函数和进度条
【发布时间】:2014-07-27 18:01:26
【问题描述】:

我有一个页面,上面有一个按钮,单击时我想加载一个加载进度条的 jquery 函数。达到 100% 时,必须隐藏进度并且必须将页面重定向到另一个网址..

但是当我点击按钮时,进度根本没有加载..

进度条的原始演示可以在下面找到.. http://www.jqueryscript.net/demo/Graphical-Circular-Timer-with-jQuery-CSS3-pietimer/

这是我到目前为止所做的......

 <script type="text/javascript">
   $(document).ready(function () {
       $('#btn').click(function () {
           $(function () {
               var timer = $('#timer');
               var url = "http://jquery4u.com";
               timer.pietimer({
                   timerSeconds: 1,
                   color: '#234',
                   fill: false,
                   showPercentage: true,
                   callback: function () {
                       timer.hide();
                       $(location).attr('href', url);
                   }
               });
           });
       });
   });
  </script>
  </head>
  <body>
  <div id="parent">
  <div id="timer"></div>
  </div>
  <div>
    <input id="btn" type="button" value="button" />
  </div>

请帮忙..

【问题讨论】:

    标签: javascript jquery html


    【解决方案1】:

    您不想在 jQuery 中包装 location 对象。

    变化:

    $(location).attr('href', url);
    

    收件人:

    window.location = url;
    

    【讨论】:

    • 完成但点击按钮进度条未加载..@charlietfl
    • 需要检查浏览器控制台看是否抛出错误
    • F12 在大多数浏览器中
    猜你喜欢
    • 1970-01-01
    • 2014-02-11
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-12-05
    相关资源
    最近更新 更多