jQuery / Twitter Bootstrap数据加载文本按钮有延迟 [英] jQuery / Twitter Bootstrap data-loading-text button with delay

查看:313
本文介绍了jQuery / Twitter Bootstrap数据加载文本按钮有延迟的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在我的网站上使用这个确切的示例:

I'm trying to get this exact example working on my website:

http://getbootstrap.com/2.3.2/javascript.html#buttons

但是,只需添加此HTML: / p>

However, simply including this HTML:

<button type="button" class="btn btn-primary" data-loading-text="Loading...">Loading state</button>

无效。我运行jQuery 1.7.x并加载了Bootstrap JS文件。

Does not work. I'm running jQuery 1.7.x and have loaded the Bootstrap JS files.

具体来说:我想让按钮移动到加载轻微延迟,然后回到常规文本。似乎没有一个很好的例子从我的谷歌在线(大多数要求永久的状态更改或切换),并且Bootstrap网站本身缺乏在这里的文档。

To be specific: I want the button to move to the "loading" text change for a slight delay, then go back to the regular text. There doesn't seem to be a good example available online from my Googling (most are asking for a permanent state change or toggle), and the Bootstrap site itself is lacking in documentation here.

推荐答案

在文档页面中,有一个文件正在加载,称为application.js。 http://twitter.github.com/bootstrap/assets/js/application.js

In the documentation page, there is a file being loaded called application.js. http://twitter.github.com/bootstrap/assets/js/application.js

// button state demo
$('#fat-btn')
    .click(function () {
        var btn = $(this)
        btn.button('loading')
        setTimeout(function () {
            btn.button('reset')
        }, 3000)
    });

这篇关于jQuery / Twitter Bootstrap数据加载文本按钮有延迟的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆