slider maximization when rolled over now works. popcorn-port
authorhamidouk
Tue, 29 Nov 2011 12:27:00 +0100
branchpopcorn-port
changeset 347 9c55d584d3a9
parent 346 08c62dbdb2b2
child 348 c9833b9c86b9
slider maximization when rolled over now works.
src/js/widgets/sliderWidget.js
--- a/src/js/widgets/sliderWidget.js	Tue Nov 29 11:10:35 2011 +0100
+++ b/src/js/widgets/sliderWidget.js	Tue Nov 29 12:27:00 2011 +0100
@@ -19,6 +19,11 @@
   // with the positionMarker when the user is dragging it
   this.draggingOngoing = false;
 
+  // another special variable used by the timeout handler to
+  // open or close the slider.
+  this.sliderMaximized = false;
+  this.timeOutId = null;
+
   this.positionMarker.draggable({axis: "x",
   start: IriSP.wrap(this, this.positionMarkerDraggingStartedHandler),
   stop: IriSP.wrap(this, this.positionMarkerDraggedHandler),
@@ -86,6 +91,13 @@
 
 /* handles mouse over the slider */
 IriSP.SliderWidget.prototype.mouseOverHandler = function(event) {
+  
+  if (this.timeOutId !== null) {
+    window.clearTimeout(this.timeOutId);
+  }
+ 
+  this.sliderMaximized = true;
+
   this.sliderBackground.animate({"height": "9px"}, 100);
   this.sliderForeground.animate({"height": "9px"}, 100);
   
@@ -95,8 +107,14 @@
 
 /* handles when the mouse leaves the slider */
 IriSP.SliderWidget.prototype.mouseOutHandler = function(event) {
+ 
+  this.timeOutId = window.setTimeout(IriSP.wrap(this, this.minimizeOnTimeout), 3000);
+};
+
+IriSP.SliderWidget.prototype.minimizeOnTimeout = function(event) {
   this.sliderBackground.animate({"height": "5px"}, 100);
   this.sliderForeground.animate({"height": "5px"}, 100);
+  this.sliderMinimized = true;
   
 //  this.selector.removeClass("Ldt-SliderMaximized");
 //  this.selector.addClass("Ldt-SliderMinimized");