Skip to content

Commit 01b81c0

Browse files
authored
feat(flyout): support short notation $.
This PR adds jquery short notation support ($.) to flyout which is made dynamically out of js properties and thus are not bound to an existing dom node. Previously you always had to select body (which still works) when no existing domnode template exists. Infact the body selector was completely ignored.
1 parent 6a18b84 commit 01b81c0

File tree

1 file changed

+8
-11
lines changed

1 file changed

+8
-11
lines changed

src/definitions/modules/flyout.js

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ window = (typeof window != 'undefined' && window.Math == Math)
2323
: Function('return this')()
2424
;
2525

26-
$.fn.flyout = function(parameters) {
26+
$.flyout = $.fn.flyout = function(parameters) {
2727
var
2828
$allModules = $(this),
2929
$window = $(window),
@@ -75,8 +75,10 @@ $.fn.flyout = function(parameters) {
7575
$pusher = $context.children(selector.pusher),
7676
$style,
7777

78+
isFlyoutComponent = $module.hasClass('flyout'),
79+
7880
element = this,
79-
instance = $module.hasClass(namespace) ? $module.data(moduleNamespace) : undefined,
81+
instance = isFlyoutComponent ? $module.data(moduleNamespace) : undefined,
8082

8183
ignoreRepeatedEvents = false,
8284
isBody = $context[0] === $body[0],
@@ -97,14 +99,17 @@ $.fn.flyout = function(parameters) {
9799
initialize: function() {
98100
module.debug('Initializing flyout', parameters);
99101

100-
if(!$module.hasClass(namespace)) {
102+
if(!isFlyoutComponent) {
101103
module.create.flyout();
102104
if(!$.isFunction(settings.onHidden)) {
103105
settings.onHidden = function () {
104106
module.destroy();
105107
$module.remove();
106108
};
107109
}
110+
if(!settings.autoShow) {
111+
settings.autoShow = true;
112+
}
108113
}
109114
$module.addClass(settings.class);
110115
if (settings.title !== '') {
@@ -422,13 +427,6 @@ $.fn.flyout = function(parameters) {
422427
$flyouts = $context.children(selector.flyout);
423428
},
424429

425-
repaint: function() {
426-
module.verbose('Forcing repaint event');
427-
element.style.display = 'none';
428-
element.scrollTop = element.scrollTop;
429-
element.style.display = '';
430-
},
431-
432430
setup: {
433431
cache: function() {
434432
module.cache = {
@@ -591,7 +589,6 @@ $.fn.flyout = function(parameters) {
591589
: function(){}
592590
;
593591
module.set.overlay();
594-
module.repaint();
595592
if(settings.returnScroll) {
596593
currentScroll = (isBody ? $window : $context).scrollTop();
597594
}

0 commit comments

Comments
 (0)