Skip to content

Instantly share code, notes, and snippets.

@tonatiuh
Created December 11, 2012 17:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tonatiuh/4260611 to your computer and use it in GitHub Desktop.
Save tonatiuh/4260611 to your computer and use it in GitHub Desktop.
Incremental height fix in the ddslick selector jquery plugin bug
// It was happening when the options weren't having description, so the plugin gets inside this function and for some reason looks like the l0Height variable gets incremented (when it shouldn't).
// The fix for me was to put the line-height as constant with the:
// var lOHeight = '35px';
// line.
//Private: Adjust appearence for drop down options (move title to middle), when no desripction
function adjustOptionsHeight(obj) {
obj.find('.dd-option').each(function () {
var $this = $(this);
var lOHeight = '35px';
var descriptionOption = $this.find('.dd-option-description');
var imgOption = obj.find('.dd-option-image');
if (descriptionOption.length <= 0 && imgOption.length > 0) {
$this.find('.dd-option-text').css('lineHeight', lOHeight);
}
});
}
@johnbatdorf
Copy link

Hey I'm having the same issue. I've put your fix in place, and it's not working, did you have to do anything else? It looks like a top margin gets added to everyone past 0, and then a bottom and top margin is added to the last one. - Thanks...

@grex22
Copy link

grex22 commented Oct 20, 2015

This appears to still be present here in 2015, as I ran across it today. I fixed it just by setting a value of "& nbsp;" (without the space, since I couldn't type it here otherwise) to the data-description property on the tags. Probably could do something similar if you're building your menu via JSON too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment