pretty-dropdowns
Advanced tools
Comparing version 1.0.0 to 1.0.6
/*! | ||
* jQuery Pretty Dropdowns Plugin v1.0.0 by T. H. Doan (http://thdoan.github.io/pretty-dropdowns/) | ||
* jQuery Pretty Dropdowns Plugin v1.0.6 by T. H. Doan (http://thdoan.github.io/pretty-dropdowns/) | ||
* | ||
@@ -13,7 +13,7 @@ * jQuery Pretty Dropdowns by T. H. Doan is licensed under the MIT License. | ||
var $this = $(this); | ||
if ($this.data('loaded') || $this.hasClass('plain')) return true; // Continue | ||
if ($this.data('loaded')) return true; // Continue | ||
// NOTE: $this.css('margin') returns empty string in Firefox. | ||
// See https://github.com/jquery/jquery/issues/3383 | ||
var nWidth = $this.outerWidth(), | ||
sHtml = '<ul title="' + $this.attr('title') + '" style="margin:' | ||
sHtml = '<ul' + ($this.attr('title')?' title="'+$this.attr('title')+'"':'') + ' style="margin:' | ||
+ $this.css('margin-top') + ' ' | ||
@@ -37,5 +37,6 @@ + $this.css('margin-right') + ' ' | ||
var $dropdown = $('ul', $this.parent()), | ||
nWidth = $dropdown.width(); | ||
nWidth = $dropdown.outerWidth(true), | ||
nOuterWidth; | ||
// Calculate width if initially hidden | ||
if (!nWidth) { | ||
if ($dropdown.width()<=0) { | ||
var $clone = $dropdown.parent().clone().css({ | ||
@@ -46,3 +47,5 @@ position: 'absolute', | ||
$('body').append($clone); | ||
nWidth = $('ul', $clone).width(); | ||
nWidth = $('ul', $clone).outerWidth(true); | ||
$('li', $clone).width(nWidth); | ||
nOuterWidth = $('ul', $clone).outerWidth(true); | ||
$clone.remove(); | ||
@@ -78,5 +81,5 @@ } | ||
$dropdown.on('mouseleave', resetDropdown); | ||
$dropdown.parent().width(nWidth+1).removeClass('loading'); | ||
$dropdown.parent().width(nOuterWidth||$dropdown.outerWidth(true)).removeClass('loading'); | ||
}); | ||
}; | ||
}(jQuery)); |
{ | ||
"name": "pretty-dropdowns", | ||
"version": "1.0.0", | ||
"version": "1.0.6", | ||
"description": "A simple, lightweight jQuery plugin to create stylized drop-down menus.", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -31,4 +31,2 @@ # jQuery Pretty Dropdowns | ||
If you don't want to convert a `<select>` element into a pretty drop-down menu, then give it a `plain` class. | ||
## Installation | ||
@@ -35,0 +33,0 @@ |
Sorry, the diff of this file is not supported yet
9141
176
40