点击showModal
#btn-game-rules
$(document).on('click', '#btn-game-rules', showModal);
调用的函数是:
showModal : function()
{
$('#' + $(this).data('modal'))
.show()
.addClass('animated bounceIn')
.one(Game.animationEnd, function() {
$(this)
.removeClass('animated bounceIn')
});
}
它的作用本质上是查找被点击的按钮的数据模态属性,并且基于该按钮显示模态(注意添加的类只是来自animate.css的一些类)以使模态外观更具娱乐性。这适用于我的mac / computer,但不能在运行android 5的Android设备上运行。模态不会出现在屏幕上。
不确定是否有必要,但这里有与特定模式(以及所有其他模式)相关的CSS:
.modal {
position: absolute;
padding: 20px;
left: 30%;
right: 30%;
top: 20px;
z-index: 10;
display: none;
}
答案 0 :(得分:1)
你对回调有错误的引用。 showModal
是某个对象的成员,因此您需要像这样引用它:
$(document).on('click', '#btn-game-rules', theObject.showModal);