Browse code
Switching the order of actions
Now adds the class to the new modal before removing from old
fiddlerwoaroof authored on 07/07/2015 05:38:37Showing 1 changed files
... | ... |
@@ -1,10 +1,10 @@ |
1 | 1 |
(function ($) { |
2 | 2 |
|
3 |
+ var currentModal = null; |
|
3 | 4 |
$.fn.myjQModal = function() { |
4 | 5 |
'use strict'; |
5 | 6 |
var self=this; |
6 | 7 |
var $self = $(self); |
7 |
- var currentModal = null; |
|
8 | 8 |
|
9 | 9 |
if ($self.length === 1 && $self[0].myjQModal !== undefined) { return $self[0].myjQModal; } |
10 | 10 |
|
... | ... |
@@ -37,8 +37,8 @@ |
37 | 37 |
wrapper: wrapper, |
38 | 38 |
|
39 | 39 |
open: function() { |
40 |
- if (currentModal !== null) { currentModal.removeClass('open'); } |
|
41 | 40 |
this.wrapper.addClass('open'); |
41 |
+ if (currentModal !== null) { currentModal.removeClass('open'); } |
|
42 | 42 |
currentModal = wrapper; |
43 | 43 |
}, |
44 | 44 |
close: function() { |