点击甚至不会在我的Android设备上启动

时间:2015-04-17 23:25:13

标签: javascript android jquery css css3

点击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;
}

1 个答案:

答案 0 :(得分:1)

你对回调有错误的引用。 showModal是某个对象的成员,因此您需要像这样引用它:

$(document).on('click', '#btn-game-rules', theObject.showModal);