简体   繁体   English

点击按钮加载jquery功能和进度条

[英]Load jquery function and progress bar on button click

I've a page on which i've a button, on clicking that i want to load a jquery function which loads a progress bar.. On reaching 100% the progress must be hidden and the page must be redirected to another URl.. 我有一个页面,上面有一个按钮,单击后我想加载一个加载进度条的jquery函数。在达到100%时,必须隐藏进度,并且该页面必须重定向到另一个URl。

But when i click the button the progress is not loading at all.. 但是当我单击按钮时,进度根本没有加载。

The original demo of the progress bar can be found below.. http://www.jqueryscript.net/demo/Graphical-Circular-Timer-with-jQuery-CSS3-pietimer/ 进度栏的原始演示可以在下面找到。http://www.jqueryscript.net/demo/Graphical-Circular-Timer-with-jQuery-CSS3-pietimer/

This is what i've done so far.. 这是我到目前为止所做的。

 <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>

Plz help.. 请帮助

You don't want to wrap the location object in jQuery. 您不想将location对象包装在jQuery中。

Change: 更改:

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

To: 至:

window.location = url;

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM