Php 单击后在模式内重新加载模式内容
我有这个非常简单的jQuery脚本,可以基于链接更改模式内容。代码:Php 单击后在模式内重新加载模式内容,php,javascript,jquery,twitter-bootstrap,Php,Javascript,Jquery,Twitter Bootstrap,我有这个非常简单的jQuery脚本,可以基于链接更改模式内容。代码: $('#facebook-friends').on('hidden', function () { $(this).removeData('modal'); }); 然后我可以根据按钮控制将使用哪些内容: <a href="facebook-frame.php" id="full-width" data-target="#facebook-friends" role="button" class="btn btn-
$('#facebook-friends').on('hidden', function () {
$(this).removeData('modal');
});
然后我可以根据按钮控制将使用哪些内容:
<a href="facebook-frame.php" id="full-width" data-target="#facebook-friends" role="button" class="btn btn-primary" data-toggle="modal"><i class="icon-facebook"></i> Use Facebook</a>
这是我主页上的模式:
<div class="modal fade hide" id="facebook-friends" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true" >
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h3 id="myModalLabel">Inviter veninder fra Facebook</h3>
</div>
<div class="modal-body text-center">
<p>Loading content...</p>
<p><IMG src="ajax-loader.gif"></p>
</div>
<div class="modal-footer">
<button class="btn" data-dismiss="modal" aria-hidden="true">Luk</button>
</div>
</div>
×
邀请人veninder fra Facebook
正在加载内容
陆克文
我特别喜欢“加载内容”,因为它看起来非常动态
有没有办法给
facebook frame.php
中的链接/按钮分配一个特殊的命令/类/名称,这样当点击它时,它会临时显示“加载内容”,然后同时加载请求的页面(在href
属性中)?如果我理解正确,在facebook frame.php
中,你能捕获所有
(或特定的
类)点击类似的事件吗
$(document).on('click', '#facebook-friends a', function(e) {
e.preventDefault();
// show the "Loading content" message
// load the content and whatever else you need to do
});
注意:.on()
需要jQuery 1.7+。在此之前,您将使用.live()
$(document).on('click', '#facebook-friends a', function(e) {
e.preventDefault();
// show the "Loading content" message
// load the content and whatever else you need to do
});