]> git.ipfire.org Git - thirdparty/foundation/foundation-sites.git/commitdiff
- Allow to reuse dropdown-content element. If a target opened the dropdown, clicking... 5086/head
authorIstrasoft <istrasoft@hotmail.com>
Wed, 30 Apr 2014 02:49:31 +0000 (04:49 +0200)
committerIstrasoft <istrasoft@hotmail.com>
Wed, 30 Apr 2014 02:49:31 +0000 (04:49 +0200)
- Remove unnecessary call to this.close.call

js/foundation/foundation.dropdown.js

index 54fddbf70c691574406f3ab5f83c6bda5c8355df..a817a89d5dd812312117886ef3c97ea92c727453 100644 (file)
             .css(Foundation.rtl ? 'right':'left', '-99999px')
             .removeClass(self.settings.active_class)
             .prev('[' + self.attr_name() + ']')
-            .removeClass(self.settings.active_class);
+            .removeClass(self.settings.active_class)
+            .removeData('target');
 
           self.S(this).trigger('closed', [dropdown]);
         }
           .css(dropdown
             .addClass(this.settings.active_class), target);
         dropdown.prev('[' + this.attr_name() + ']').addClass(this.settings.active_class);
-        dropdown.trigger('opened', [dropdown, target]);
+        dropdown.data('target', target.get(0)).trigger('opened', [dropdown, target]);
     },
 
     data_attr: function () {
 
       if (dropdown.hasClass(this.settings.active_class)) {
         this.close.call(this, dropdown);
+        if (dropdown.data('target') !== target.get(0))
+          this.open.call(this, dropdown, target);
       } else {
-        this.close.call(this, this.S('[' + this.attr_name() + '-content]'))
         this.open.call(this, dropdown, target);
       }
     },