我正在使用 jquery bpopup 插件。我想对页面上的所有按钮/弹出窗口使用相同的脚本。不幸的是,每个按钮点击在页面加载后只能工作一次。我会非常感谢你的帮助!
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<script src="http://code.jquery.com/jquery-latest.min.js" type="text/javascript"></script>
<script src="http://dinbror.dk/downloads/jquery.bpopup-0.7.0.min.js" type="text/javascript"></script>
<script language="javascript" type="text/javascript">
$(document).ready(function() {
$('.button').live('click', function(e) {
// Prevents the default action to be triggered.
e.preventDefault();
// Triggering bPopup when click event is fired
$(this).find('.popup').bPopup({
});
});
});
</script>
</head>
<body>
<!-- Button 1 -->
<div class="button">Button1
<div class="popup" style="background-color:#fff; width:400px; height:400px; display:none">
PopUp Content1
</div>
</div>
<!-- Button 2 -->
<div class="button">Button2
<div class="popup" style="background-color:#fff; width:400px; height:400px; display:none">
PopUp Content2
</div>
</div>
</body>
</html>