Browse Source

Merge pull request #3 from volpino/master

Fixed variable scope error that prevented correct dragging handling
Mattia Larentis 12 years ago
parent
commit
6fca8e7e00
1 changed files with 5 additions and 4 deletions
  1. 5 4
      static/js/jquery.switch.js

+ 5 - 4
static/js/jquery.switch.js

@@ -12,7 +12,8 @@
               , $label
               , myClasses = ""
               , classes = $element.attr('class')
-              , color;
+              , color
+              , moving;
 
             $.each(['switch-mini', 'switch-small', 'switch-large'], function (i, el) {
               if (classes.indexOf(el) >= 0)
@@ -88,8 +89,8 @@
             });
 
             $element.find('label').on('mousedown touchstart', function (e) {
-              var $this = $(this)
-                , moving = false;
+              var $this = $(this);
+              moving = false;
 
               e.preventDefault();
               e.stopImmediatePropagation();
@@ -197,4 +198,4 @@
 
 $(function () {
   $('.switch').switch();
-});
+});