Created
November 9, 2015 20:31
-
-
Save interactivellama/3157d5bf8c0361d686b6 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function _getContainer(element) { | |
| var containerElement, isWindow; | |
| // manual override | |
| if (element.attr('data-target') && element.attr('data-target') !== 'window') { | |
| containerElement = element.attr('data-target'); | |
| isWindow = false; | |
| } else { | |
| // default to window otherwise | |
| containerElement = window; | |
| isWindow = true; | |
| if (!element.attr('data-target')) { | |
| // unless there's a parent element with non-visible overflow | |
| $.each(element.parents(), function (index, value) { | |
| if ($(value).css('overflow') !== 'visible') { | |
| containerElement = value; | |
| isWindow = false; | |
| return false; | |
| } | |
| }); | |
| } | |
| } | |
| return { | |
| overflowElement: $(containerElement), | |
| isWindow: isWindow | |
| }; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment