Skip to content

Commit 7a0437f

Browse files
author
AMJones
committed
Fixes issue with dropdown menus in overflow toolbar.
1 parent 87e8f84 commit 7a0437f

File tree

2 files changed

+12
-7
lines changed

2 files changed

+12
-7
lines changed

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"layout"
1010
],
1111
"homepage": "https://www.github.com/strapless/layout",
12-
"version": "1.1.2",
12+
"version": "1.1.3",
1313
"authors": [
1414
{
1515
"name": "Aaron M Jones",

js/tab-scroll.js

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/**
22
* jQuery plugin to handle width overflow of bootstrap tabs in a manner similar to tab handling on Android.
33
*
4-
* @version v1.1.2
4+
* @version v1.1.3
55
* @license https://github.com/strapless/layout/LICENSE
66
* @author Aaron M Jones <am@jonesiscoding.com>
77
*/
@@ -25,22 +25,27 @@
2525
* @type object
2626
*/
2727
plugin.settings = {};
28+
plugin.sel = {};
2829

2930
var $el = $(element);
3031

3132
plugin.init = function() {
3233

3334
plugin.settings = $.extend({}, defaults, options);
3435

36+
$.each(plugin.settings.cls, function(key,val) { plugin.sel[key] = '.' + val; });
37+
3538
$(window).afterwards('resize', function () {
3639
plugin.toggleMarker(plugin.hasOverflow());
3740
});
3841

3942
$(document).on('show.bs.dropdown', '[data-overflow="true"]', function(e) {
40-
var $dropdown = $(e.target).find(plugin.settings.cls.dropdown);
41-
var $trigger = $dropdown.parent('.' + plugin.settings.cls.wrapper).find('.' + plugin.settings.cls.toggle);
42-
var top = $trigger.offset().top + $trigger.outerHeight();
43-
var left = $trigger.offset().left;
43+
var $dropdown = $(e.target).find(plugin.sel.dropdown);
44+
var $trigger = $dropdown.parent(plugin.sel.wrapper).find(plugin.sel.toggle);
45+
var offset = $(e.target).offset();
46+
47+
var top = offset.top + $trigger.outerHeight() - 3;
48+
var left = offset.left;
4449
$dropdown.appendTo('body').css({left: left + 'px', top: top + 'px', 'max-height': 'calc(90vh - ' + top + 'px)', 'overflow-y': 'scroll' });
4550
$('body').addClass(plugin.settings.cls.open);
4651
$(this).on('hidden.bs.dropdown', function () {
@@ -50,7 +55,7 @@
5055
});
5156

5257
if (!$(document).hasClass('.touch')) {
53-
$el.on('click', '.' + plugin.settings.cls.marker, function(e) { plugin.onClick(e); });
58+
$el.on('click', plugin.sel.marker, function(e) { plugin.onClick(e); });
5459
}
5560

5661
plugin.toggleMarker(plugin.hasOverflow());

0 commit comments

Comments
 (0)