jQuery Mobile + Backbone tap事件触发两次

Gar*_*ett 4 jquery touch-event jquery-mobile backbone.js

这是我在视图中定义事件的位置:

events : {
            "tap #exerciseProgressBarContainer" : 'progressBarClick'
        },
Run Code Online (Sandbox Code Playgroud)

这是行动:

    progressBarClick : function() {
        // start?
        if(this.curWorkoutExercise.isTimed() && !this.curExerciseStartTime) {
            HTMLHelper.endGlow(this.$('#exerciseProgressBarContainer .progressBar.overlay'));
            this.startExerciseProgressTimer();
        }
        // done?
        else {
            this.stopExerciseProgressTimer();

            // save the log
            this.addCurExerciseLog();

            this.startBreak();
            this.nextAction();
        }
    },
Run Code Online (Sandbox Code Playgroud)

基本上,在第一次点击时,用户启动进度计时器,并在其启动后,另一次点击完成它.在我的iPhone和我的Android上发生的事情是点击事件触发两次,同时启动和停止进度条.任何想法为什么会发生这种情况以及如何解决它?注意:我已经尝试过交换tapvclick.

非常感谢!

Gar*_*ett 5

我最终使用e.stopPropagation() 和 停止事件传播 e.preventDefault()