PageSourceSearch

https://www.cytivalifesciences.co.kr/wp-content/plugins/oxyextras/components/assets/megamenu-init.js?ver=1.0.2

js cytivalifesciences.co.kr collected 2026-10-08 07:24:51 UTC 14,797 bytes, 346 lines download raw bytes

1jQuery(document).ready(oxygen_init_megamenu);
2function oxygen_init_megamenu($) {
3
4    var touchEvent = 'ontouchstart' in window ? 'click' : 'click';
5
6    var url = window.location;
7    var pathname = window.location.pathname;
8
9    $(".oxy-mega-dropdown_link").filter(function() {
10        return (this.href == url || this.href + '/' == url || this.href == pathname || this.href + '/' == pathname );
11    }).addClass('oxy-mega-dropdown_link-current');
12
13    $('.oxy-mega-dropdown_flyout').has('.current-menu-item').siblings('.oxy-mega-dropdown_link').addClass('oxy-mega-dropdown_link-current-ancestor');
14
15    $(".oxy-mega-menu").each(function(i, oxyMegaMenu){
16
17        var $oxyMegaMenu = $( oxyMegaMenu ),
18            inner = $oxyMegaMenu.children('.oxy-mega-menu_inner'),
19            oxyMegaMenuID = $( oxyMegaMenu ).attr('id'),
20            clicktrigger = inner.data('trigger'),
21            oDelay = inner.data('odelay'),
22            cDelay = inner.data('cdelay'),
23            flyMenu = inner.find('.oxy-mega-dropdown_flyout-click-area').parent('.oxy-mega-dropdown_link'),
24            slideDuration = inner.data('duration'),
25            mouseoverReveal = inner.data('mouseover'),
26            preventScroll = inner.data('prevent-scroll'),
27            hashlinkClose = inner.data('hash-close'),
28            slide_trigger_selector = clicktrigger,
29            slideClickArea = $oxyMegaMenu.find('.oxy-mega-dropdown_icon'),
30            auto_aria = inner.data('auto-aria');
31
32            inner.find('.oxy-mega-dropdown_link').css("cursor","pointer");
33
34              
35            function ariaExpandToggle($state) {
36                if ( true === auto_aria ) {
37                    $(slide_trigger_selector).each(function(i,trigger) {
38                        if ( $(trigger).hasClass('oxy-burger-trigger') && $(trigger).children('.hamburger').length ) {
39                            $(trigger).children('.hamburger').attr('aria-expanded', $state);
40                        } else {
41                            $(trigger).attr('aria-expanded', $state);
42                            $(trigger).attr('role','button');
43                        }
44                    });
45                }
46            }
47
48              if ( true === auto_aria ) {
49
50                $(slide_trigger_selector).each(function(i,trigger) {
51
52                    if ( $(trigger).hasClass('oxy-burger-trigger') && $(trigger).children('.hamburger').length ) {
53                        $(trigger).children('.hamburger').attr('aria-controls', oxyMegaMenuID);
54                    } else {
55                        $(trigger).attr('aria-controls', oxyMegaMenuID);
56                    }
57                });
58
59                ariaExpandToggle('false');
60             }
61
62              $(slide_trigger_selector).on( touchEvent, function(e) { 
63
64                 e.stopPropagation();
65                 e.preventDefault();  
66                 $oxyMegaMenu.slideToggle(slideDuration);
67
68                 if ( true === auto_aria ) {
69
70                    if ( 'true' === $(slide_trigger_selector).attr('aria-expanded') || 'true' === $(slide_trigger_selector).children('.hamburger').attr('aria-expanded') ) {
71                        ariaExpandToggle('false');
72                    } else {
73                        ariaExpandToggle('true');
74                    }
75
76                 }
77
78                 $oxyMegaMenu.children('.oxy-mega-menu_inner').toggleClass('oxy-mega-menu_mobile');
79                  
80                 if (true === preventScroll) {
81                    $('body,html').toggleClass( 'oxy-nav-menu-prevent-overflow' );
82                 }  
83              } );
84
85        
86        var megaStatus = false;
87        var mobileStatus = false;
88        var megaInitialised = false;
89        
90        // --> Trigger accessible menu just 1x...
91            var triggerMegaMenu = function() {
92
93              if (!megaStatus) {
94
95                megaStatus = true; // so only fires 1x
96
97                if (!megaInitialised) {
98
99                      $(oxyMegaMenu).accessibleMegaMenu({
100                        uuidPrefix: oxyMegaMenuID,
101                        menuClass: "oxy-mega-menu_inner",
102                        topNavItemClass: "oxy-mega-dropdown",
103                        panelClass: "oxy-mega-dropdown_inner",
104                        panelGroupClass: "mega-column",
105                        hoverClass: "oxy-mega-dropdown_inner-hover",
106                        focusClass: "oxy-mega-dropdown_inner-focus",
107                        openClass: "oxy-mega-dropdown_inner-open",
108                        toggleButtonClass: "oxy-burger-trigger",
109                        openDelay: oDelay,
110                        closeDelay: cDelay,
111                        openOnMouseover: mouseoverReveal
112                    });
113
114                    megaInitialised = true;
115
116                } else {
117                    $(oxyMegaMenu).data('plugin_accessibleMegaMenu').init();
118                }
119                  
120                $('.oxy-mega-dropdown_just-link').off( "click" ); 
121                  
122                if (true === inner.data('hovertabs')) {
123
124                    $oxyMegaMenu.find('.oxy-tab').attr('tabindex','0');
125
126                    $oxyMegaMenu.find('.oxy-tab').on('mouseenter focus', function() { 
127                        $(this).click(); 
128                    }); 
129                    
130                }
131
132              }
133
134            }
135
136       // Only fire the megamenu function is menu is visible (meaning we're not on mobile)
137        var checkMegaDisplay = function() {
138                
139            // Desktop
140            if ( 'hidden' === $( oxyMegaMenu ).css("backface-visibility") ) {
141                $(oxyMegaMenu).removeAttr("style");
142                $(oxyMegaMenu).find('.oxy-mega-dropdown_inner').removeAttr("style");
143                triggerMegaMenu();
144                $( oxyMegaMenu ).off( touchEvent );
145                mobileStatus = false;
146                $('body,html').removeClass( 'oxy-nav-menu-prevent-overflow' );
147                $(oxyMegaMenu).find('.oxy-mega-menu_inner').removeClass('oxy-mega-menu_mobile');
148              } 
149            // Mobile
150            else {
151
152                  // if MegaMenu already init, let's remove it
153                  if (megaStatus) {  
154                        $( oxyMegaMenu).find('.oxy-mega-dropdown_link').removeClass('oxy-mega-dropdown_inner-open');  
155                        $( oxyMegaMenu ).data('plugin_accessibleMegaMenu').destroy();
156                        $oxyMegaMenu.find('.oxy-tab').off('mouseenter focus');
157                        megaStatus = false; 
158                  }
159                
160                  if (!mobileStatus) {
161                      
162                      mobileStatus = true; // so only fires 1x
163
164                    if ($(slide_trigger_selector).hasClass('oxy-burger-trigger')) {
165                        $(slide_trigger_selector).children('.hamburger').removeClass('is-active');
166                    }
167                      
168                      $( oxyMegaMenu).find('.oxy-mega-dropdown_link[data-expanded=enable]').addClass('oxy-mega-dropdown_inner-open');
169                      
170                      $( oxyMegaMenu ).off( touchEvent );
171                      $( oxyMegaMenu ).on( touchEvent, '.oxy-mega-menu_mobile li > a', function(e) {
172
173
174                          if ($(e.target).closest('.oxy-mega-dropdown_flyout-click-area').length > 0) { 
175                                
176                                e.preventDefault();
177                                e.stopPropagation();
178                                oxy_subMenu_toggle(this, slideDuration);
179                            }
180                          
181                            else if ($(e.target).attr("href") === "#" && $(e.target).parent().hasClass('menu-item-has-children')) {
182                               
183                                var subflyoutButton = $(e.target).find('.oxy-mega-dropdown_flyout-click-area');
184                                e.preventDefault();
185                                e.stopPropagation();
186                                oxy_subMenu_toggle(subflyoutButton, slideDuration);
187                                
188                            } else if ($(e.target).closest('.oxy-mega-dropdown_link:not(.oxy-mega-dropdown_just-link) .oxy-mega-dropdown_icon').length > 0) {
189                          
190                                e.stopPropagation();
191                                e.preventDefault();
192                                oxy_megaMenu_toggle(this, slideDuration);
193
194                            } else if ($(e.target).closest('.oxy-mega-dropdown_link').is('a[href^="#"]') && $(e.target).closest('.oxy-mega-dropdown_link').parent().hasClass('oxy-mega-dropdown') && !$(e.target).closest('.oxy-mega-dropdown_link').hasClass('oxy-mega-dropdown_just-link') ) {
195                                
196                                e.stopPropagation();
197                                e.preventDefault();
198                                oxy_megaMenu_toggle(this, slideDuration);
199                                
200                            } else if ($(e.target).closest('.oxy-mega-dropdown_link').data('disable-link') === 'enable') {
201                                
202                                e.stopPropagation();
203                                e.preventDefault();
204                                oxy_megaMenu_toggle(this, slideDuration);
205                                
206                            } else if ( $(e.target).closest('.oxy-mega-dropdown_link').hasClass('oxy-mega-dropdown_just-link') && $(e.target).closest('.oxy-mega-dropdown_link').is('a[href^="#"]') ) {
207
208                                e.stopPropagation();
209                               setTimeout(function() {
210                                    $(slide_trigger_selector).trigger('click')
211                                }, 0);
212
213                            }
214                              
215                          });
216                      
217                  }
218                      
219                
220            }
221
222        }
223
224        
225        checkMegaDisplay();
226        $(window).on("load resize orientationchange",function(e){
227          checkMegaDisplay();
228        });
229
230        if (true === hashlinkClose) {
231
232            inner.on('click', '.oxy-mega-dropdown_inner a[href*="#"]:not(.menu-item-has-children > a), a.oxy-mega-dropdown_just-link[href*="#"]', function() {
233
234                if ('hidden' === $oxyMegaMenu.css("backface-visibility")) { // If desktop
235        
236                    $oxyMegaMenu.find('.oxy-mega-dropdown_inner-open').removeClass('oxy-mega-dropdown_inner-open');
237        
238                } else {
239
240                    if ( $(this).closest('.oxy-mega-dropdown_inner').siblings('.oxy-mega-dropdown_inner-open').length ) {
241                        $(this).closest('.oxy-mega-dropdown_inner').siblings('.oxy-mega-dropdown_inner-open').trigger('click');
242                    }
243
244                    $(slide_trigger_selector).trigger('click');
245
246                }
247        
248            });
249            
250
251        }
252
253
254    });  // each
255
256
257    
258    function oxy_subMenu_toggle(trigger, durationData) {
259        $(trigger).closest('.menu-item-has-children').children('.sub-menu').slideToggle( durationData );
260        $(trigger).closest('.menu-item-has-children').siblings('.menu-item-has-children').children('.sub-menu').slideUp( durationData );
261        $(trigger).children('.oxy-mega-dropdown_flyout-click-area').attr('aria-expanded', function (i, attr) {
262            return attr == 'true' ? 'false' : 'true'
263        });
264
265        $(trigger).children('.oxy-mega-dropdown_flyout-click-area').attr('aria-pressed', function (i, attr) {
266            return attr == 'true' ? 'false' : 'true'
267        });
268    }
269
270    function oxy_megaMenu_toggle(trigger, durationData) {
271
272            var othermenus = $(trigger).parent('.oxy-mega-dropdown').siblings('.oxy-mega-dropdown');
273                             othermenus.find( '.oxy-mega-dropdown_inner' ).slide
273Up( durationData );
274                             othermenus.find( '.oxy-mega-dropdown_link' ).removeClass( 'oxy-mega-dropdown_inner-open' );
275
276            $(trigger).next('.oxy-mega-dropdown_inner').slideToggle( durationData );
277            $(trigger).toggleClass( 'oxy-mega-dropdown_inner-open' );
278
279            $(trigger).attr('aria-expanded', function (i, attr) {
280                return attr == 'true' ? 'false' : 'true'
281            });
282
283            $(trigger).attr('aria-pressed', function (i, attr) {
284                return attr == 'true' ? 'false' : 'true'
285            });
286
287            $(trigger).next('oxy-slide-menu_open');
288        
289            
290         // Resize carousel as opened if found
291            if ($(trigger).next('.oxy-mega-dropdown_inner').has('.flickity-enabled')) {
292                setTimeout(function() {
293                    var carousel = $(trigger).next('.oxy-mega-dropdown_inner').find('.flickity-enabled');
294                    if (carousel.length) {
295                    var flkty = Flickity.data( carousel[0] );
296                        flkty.resize();
297                    }
298                }, 100);
299
300            }
301            
302
303        }  
304
305
306    $('.oxy-mega-dropdown_just-link').parent('.oxy-mega-dropdown').addClass('oxy-mega-dropdown_no-dropdown')
307
308
309    var options = {
310          attributes: true,
311          attributeFilter: ['class'], 
312          subtree: true
313        },
314        observer = new MutationObserver(mCallback);
315
316        function mCallback (mutations) {
317          for (var mutation of mutations) {
318
319              if (mutation.type === 'attributes') {
320
321                        if (($(mutation.target).closest('.oxy-mega-menu_inner').has( ".oxy-mega-dropdown_inner-open" ).length) && !($(mutation.target).closest('.oxy-mega-menu_inner').has( ".oxy-mega-dropdown_inner-open.oxy-mega-dropdown_just-link" ).length) ) {
322                            $(mutation.target).closest('.oxy-mega-menu_inner').addClass('oxy-mega-menu_active');
323                        } else {
324                            $(mutation.target).closest('.oxy-mega-menu_inner').removeClass('oxy-mega-menu_active');
325                        }
326
327                    }
328              }
329        }
330
331        var MegaMenus = document.querySelectorAll('.oxy-mega-menu_inner[data-type=container]'); 
332        MegaMenus.forEach(MegaMenu => {
333            observer.observe(MegaMenu, options);
334        }); 
335
336
337     $(".oxy-mega-dropdown_flyout").each(function(i, oxyDropdown){
338
339        var icon = $(oxyDropdown).data('icon');
340
341        $(oxyDropdown).find('.menu-item-has-children > a').append('<button tabindex="-1" aria-expanded=\"false\" aria-pressed=\"false\" class=\"oxy-mega-dropdown_flyout-click-area\"><svg class=\"oxy-mega-dropdown_flyout-icon\"><use xlink:href=\"#'+ icon + '\"></use></svg><span class=\"screen-reader-text\">Submenu</span></button>');
342
343    });
344
345
346}

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.