From 1c31a2799c695474f259e234549a0cf4ebbb7926 Mon Sep 17 00:00:00 2001 From: dave Date: Thu, 28 Aug 2014 22:59:49 -0700 Subject: [PATCH] Don't update the time automatically when the slider is dragged --- static/js/app.js | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/static/js/app.js b/static/js/app.js index dd55465..5243f56 100644 --- a/static/js/app.js +++ b/static/js/app.js @@ -152,20 +152,23 @@ var behaviors = { loadedmetadata: function() { // Create slider with a max val of this track's length $(".time-holder").html('') - $(".time-holder .player-slider").slider({min:0,max:parseInt($("#player").data("jPlayer").status.duration+1),tooltip:"hide",slideStart:function(){ + $(".time-holder .player-slider").slider({min:0,max:parseInt($("#player").data("jPlayer").status.duration+1),tooltip:"hide"}) + $(".time-holder .player-slider").on("slideStart", function(){ // Add a class to the slider on hover - $(this).parent().addClass("dragging") - },slideStop:function(){ - $(this).parent().removeClass("dragging") - }}) + $(this).addClass("dragging") + }).on("slideStop", function(){ + $(this).removeClass("dragging") + }); }, play:function() { }, timeupdate:function(event) { - // About 4 times a second // See if we are not sliding - + if($(".time-holder .player-slider").hasClass("dragging")) { + return; + } + // Update the slider $(".time-holder .player-slider").slider('setValue', event.jPlayer.status.currentTime); // And update the time minutes = Math.floor(event.jPlayer.status.currentTime/60)