PageSourceSearch

https://westcozcafe.com/Scripts/themes/theme_8/getz-dropdownhover.js?v=27.20260916-124

js westcozcafe.com collected 2026-09-30 10:40:09 UTC 14,016 bytes, 410 lines download raw bytes

1$(function () { // DOM ready
2    // If a link has a dropdown, add sub menu toggle.
3    $('#header nav #navbar-collapse-1 ul li a:not(:only-child)').click(function (e) {
4        //  $(this).siblings('.nav-dropdown').toggle();
5        // Close one dropdown when selecting another
6        //  $('.nav-dropdown').not($(this).siblings()).hide();       
7        e.stopPropagation();
8    });
9
10    //// Clicking away from dropdown will remove the dropdown class
11    //$('html').click(function () {    
12    //    $('.nav-dropdown').hide();
13    //});
14    //// Toggle open and close nav styles on click
15    //$('#nav-toggle').click(function () {    
16    //    $('nav ul').slideToggle();
17    //});
18    //// Hamburger to X toggle
19    //$('#nav-toggle').on('click', function () {    
20    //    this.classList.toggle('active');
21    //});
22
23    $('#getz-menu-mainsub-category li.parent').on('mouseover', function (e) {
24        var $menuItem = $(this),
25            $submenuWrapper = $('> .wrapper', $menuItem),
26            win = $(window);
27
28        $menuItem.css({ bottom: '', left: '', top: '', right: '' }).removeClass('dropdownhover-top')
29
30        var viewport = {
31            top: win.scrollTop(),
32            left: win.scrollLeft()
33        }
34
35        viewport.right = viewport.left + win.width();
36        viewport.bottom = viewport.top + win.height();
37
38        // grab the menu item's position relative to its positioned parent
39        var menuItemPos = $menuItem.position();
40        var bounds = $menuItem.offset();
41
42        bounds.right = bounds.left + $menuItem.outerWidth();
43        bounds.bottom = bounds.top + $menuItem.outerHeight();
44
45        var position = $menuItem.position();
46        position.right = bounds.left + $menuItem.outerWidth();
47        position.bottom = bounds.top + $menuItem.outerHeight();
48
49        var side = ''
50
51        if (position.left < 0) {
52            side = 'left'
53            $menuItem.removeClass('dropdownhover-right').addClass('dropdownhover-left')
54        } else {
55            side = 'right'
56            $menuItem.addClass('dropdownhover-right').removeClass('dropdownhover-left')
57        }
58
59        if (bounds.left < viewport.left) {
60            side = 'right'
61            $menuItem.css({ left: '100%', right: 'auto' }).addClass('dropdownhover-right').removeClass('dropdownhover-left')
62        } else if (bounds.right > viewport.right) {
63            side = 'left'
64            $menuItem.css({ left: 'auto', right: '100%' }).removeClass('dropdownhover-right').addClass('dropdownhover-left')
65        }
66
67        if (bounds.bottom > viewport.bottom) {
68            $menuItem.css({ bottom: 'auto', top: -(bounds.bottom - viewport.bottom) })
69        } else if (bounds.top < viewport.top) {
70            $menuItem.css({ bottom: -(viewport.top - bounds.top), top: 'auto' })
71        }
72
73        if ((bounds.right * 2 - bounds.left) > viewport.right) {
74            side = 'left'
75            $menuItem.removeClass('dropdownhover-right').addClass('dropdownhover-left')
76        } else {
77            $menuItem.addClass('dropdownhover-right').removeClass('dropdownhover-left')
78        }
79
80        if (side === 'right') {
81            $submenuWrapper.css({
82                top: menuItemPos.top,
83                left: menuItemPos.left + Math.round($menuItem.outerWidth() * 1)
84            });
85        } else {
86            $submenuWrapper.css({
87                top: menuItemPos.top,
88                left: -(menuItemPos.left + Math.round($menuItem.outerWidth() * 1))
89            });
90        }
91
92    });
93}); // end DOM ready
94
95/*!
96 * Dropdownhover v1.0.0 (http://bs-dropdownhover.kybarg.com)
97 */
98// +function ($) {
99// 'use strict';
100
101// DROPDOWNHOVER CLASS DEFINITION
102// =========================
103var Dropdownhover = function (element, options) {
104    this.options = options;
105    this.$element = $(element);
106
107    var that = this;
108
109    // Defining if navigation tree or single dropdown
110    this.dropdowns = this.$element.hasClass('dropdown-toggle') ? this.$element.parent().find('.dropdown-menu').parent('.dropdown') : this.$element.find('.dropdown');
111
112    this.dropdowns.each(function () {
113        $(this).on('mouseenter.bs.dropdownhover', function (e) {
114
115            that.show($(this).children('a, button'))
116        })
117    });
118    this.dropdowns.each(function () {
119        $(this).on('mouseleave.bs.dropdownhover', function (e) {
120
121            that.hide($(this).children('a, button'))
122        })
123    });
124
125    this.dropdownGetz = this.$element.hasClass('dropdown-toggle') ? this.$element.parent().find('.dropdown-menu-getz').parent('.dropdown-getz') : this.$element.find('.dropdown-getz');
126
127    this.dropdownGetz.each(function () {
128        $(this).on('mouseenter.bs.dropdownhover', function (e) {
129
130            that.show($(this).children('a, button'))
131        })
132    });
133    this.dropdownGetz.each(function () {
134        $(this).on('mouseleave.bs.dropdownhover', function (e) {
135
136            that.hide($(this).children('a, button'))
137        })
138    });
139}
140
141Dropdownhover.TRANSITION_DURATION = 300
142Dropdownhover.DELAY = 150
143Dropdownhover.TIMEOUT
144
145Dropdownhover.DEFAULTS = {
146    animations: ['fadeInDown', 'fadeInRight', 'fadeInUp', 'fadeInLeft'],
147}
148
149// Opens dropdown menu when mouse is over the trigger element
150Dropdownhover.prototype.show = function (_dropdownLink) {
151
152    var $this = $(_dropdownLink)
153
154    window.clearTimeout(Dropdownhover.TIMEOUT)
155    // Close all dropdowns
156    $('.dropdown').not($this.parents()).each(function () {
157        $(this).removeClass('open');
158    });
159
160    var effect = this.options.animations[0]
161
162    if ($this.is('.disabled, :disabled')) return
163
164    var $parent = $this.parent()
165    var isActive = $parent.hasClass('open')
166
167    if (!isActive) {
168
169        var $dropdown = $this.next('.dropdown-menu');
170        var $dropdownGetz = $this.next('.dropdown-menu-getz');
171        var relatedTarget = { relatedTarget: this };
172
173        $parent
174          .addClass('open')
175
176        var side = this.position($dropdown)
177
178        //alert(side)
179        side == 'top' ? effect = this.options.animations[2] :
180        side == 'right' ? effect = this.options.animations[3] :
181        side == 'left' ? effect = this.options.animations[1] :
182        effect = this.options.animations[0]
183
184        $dropdown.addClass('animated ' + effect)
185
186        var transition = $.support.transition && $dropdown.hasClass('animated')
187
188        transition ?
189          $dropdown
190            .one('bsTransitionEnd', function () {
191                $dropdown.removeClass('animated ' + effect)
192            })
193            .emulateTransitionEnd(Dropdownhover.TRANSITION_DURATION) :
194          $dropdown.removeClass('animated ' + effect)
195    }
196
197    return false
198}
199
200// Closes dropdown menu when moise is out of it
201Dropdownhover.prototype.hide = function (_dropdownLink) {
202
203    var that = this
204    var $this = $(_dropdownLink)
205    var $parent = $this.parent()
206    Dropdownhover.TIMEOUT = window.setTimeout(function () {
207        $parent.removeClass('open')
208    }, Dropdownhover.DELAY)
209}
210
211// Calculating position of dropdown menu
212Dropdownhover.prototype.position = function (dropdown) {
213
214    var win = $(window);
215    // Reset css to prevent incorrect position
216    dropdown.css({ bottom: '', left: '', top: '', right: '' }).removeClass('dropdownhover-top')
217
218    var viewport = {
219        top: win.scrollTop(),
220        left: win.scrollLeft()
221    };
222    viewport.right = viewport.left + win.width();
223    viewport.bottom = viewport.top + win.height();
224
225    var bounds = dropdown.offset();
226    bounds.right = bounds.left + dropdown.outerWidth();
227    bounds.bottom = bounds.top + dropdown.outerHeight();
228    var position = dropdown.position();
229    position.right = bounds.left + dropdown.outerWidth();
230    position.bottom = bounds.top + dropdown.outerHeight();
231
232    var side = ''
233
234    var isSubnow = dropdown.parents('.dropdown-menu').length
235
236    if (isSubnow) {
237
238        if (position.left < 0) {
239            side = 'left'
240            dropdown.removeClass('dropdownhover-right').addClass('dropdownhover-left')
241        } else {
242            side = 'right'
243            dropdown.addClass('dropdownhover-right').removeClass('dropdownhover-left')
244        }
245
246        if (bounds.left < viewport.left) {
247            side = 'right'
248            dropdown.css({ left: '100%', right: 'auto' }).addClass('dropdownhover-right').removeClass('dropdownhover-left')
249        } else if (bounds.right > viewport.right) {
250            side = 'left'
251            dropdown.css({ left: 'auto', right: '100%' }).removeClass('dropdownhover-right').addClass('dropdownhover-left')
252        }
253
254        if (bounds.bottom > viewport.bottom) {
255            dropdown.css({ bottom: 'auto', top: -(bounds.bottom - viewport.bottom) })
256        } else if (bounds.top < viewport.top) {
257            dropdown.css({ bottom: -(viewport.top - bounds.top), top: 'auto' })
258        }
259
260    } else { // Defines special position styles for root dropdown menu
261
262        var parentLi = dropdown.parent('.dropdown')
263        var pBounds = parentLi.offset()
264        pBounds.right = pBounds.left + parentLi.outerWidth()
265        pBounds.bottom = pBounds.top + parentLi.outerHeight()
266
267        if (bounds.right > viewport.right) {
268            dropdown.css({ left: -(bounds.right - viewport.right), right: 'auto' })
269        }
270
271        if (bounds.bottom > viewport.bottom && (pBounds.top - viewport.top) > (viewport.bottom - pBounds.bottom) || dropdown.position().top < 0) {
272            side = 'top'
273            dropdown.css({ bottom: '100%', top: 'auto' }).addClass('dropdownhover-top').removeClass('dropdownhover-bottom')
274        } else {
275            side = 'bottom'
276            dropdown.addClass('dropdownhover-bottom')
277        }
278    }
279
280    return side;
281}
282
283
284// DROPDOWNHOVER PLUGIN DEFINITION
285// ==========================
286
287function Plugin(option) {
288    return this.each(function () {
289        var $self = $(this)
290        var data = $self.data('bs.dropdownhover')
291        var settings = $self.data()
292        if ($self.data('animations') !== undefined && $self.data('animations') !== null)
293            settings.animations = $.isArray(settings.animations) ? settings.animations : settings.animations.split(' ')
294
295        var options = $.extend({}, Dropdownhover.DEFAULTS, settings, typeof option == 'object' && option)
296
297        if (!data) $self.data('bs.dropdownhover', (data = new Dropdownhover(this, options)))
298
299    })
300}
301
302var old = $.fn.dropdownhover
303
304$.fn.dropdownhover = Plugin
305$.fn.dropdownhover.Constructor = Dropdownhover
306
307
308// DROPDOWNHOVER NO CONFLICT
309// ====================
310$.fn.dropdownhover.noConflict = function () {
311    $.fn.dropdownhover = old
312    return this
313}
314
315
316// APPLY TO STANDARD DROPDOWNHOVER ELEMENTS
317// ===================================
318var resizeTimer;
319$(document).ready(function () {
320    if ($(window).width() >
320= 768) { // Breakpoin plugin is activated (768px)
321        $('[data-hover="dropdown"]').each(function () {
322            var $target = $(this)
323            Plugin.call($target, $target.data())
324        })
325    }
326})
327
328//$(window).on('resize', function () {
329//    clearTimeout(resizeTimer);
330//    resizeTimer = setTimeout(function () {
331//        if ($(window).width() >= 768) // Breakpoin plugin is activated (768px)
332//            $('[data-hover="dropdown"]').each(function () {
333//                var $target = $(this)
334//                Plugin.call($target, $target.data())
335//            })
336//        else  // Disabling and clearing plugin data if screen is less 768px
337//            $('[data-hover="dropdown"]').each(function () {
338//                $(this).removeData('bs.dropdownhover')
339//                if ($(this).hasClass('dropdown-toggle'))
340//                    $(this).parent('.dropdown').find('.dropdown').andSelf().off('mouseenter.bs.dropdownhover mouseleave.bs.dropdownhover')
341//                else
342//                    $(this).find('.dropdown').off('mouseenter.bs.dropdownhover mouseleave.bs.dropdownhover')
343//            })
344//    }, 200)
345//})
346
347//}(jQuery);
348
349
350$(function () {
351    $('#menu-mb .is-main-category ul').hide();
352    $('#menu-mb .is-main-category').on('click', function () {
353        //$(this).find('ul').toggleClass('list-category-show');
354        $(this).find('ul').slideToggle();
355        $(this).find('ul').parent().toggleClass('open');
356    })
357});
358
359
360/*
361    Dropdown menu mobile
362*/
363$(document).ready(function () {
364    var AccordionGetz = function (el, multiple) {
365        this.el = el || {};
366        this.multiple = multiple || false;
367
368        // Variables privadas
369        var links = this.el.find('.link');
370        // Evento
371        links.on('click', { el: this.el, multiple: this.multiple }, this.dropdown)
372    };
373
374    AccordionGetz.prototype.dropdown = function (e) {
375        var $el = e.data.el;
376        $this = $(this),
377        $next = $this.next();
378
379        $next.slideToggle();
380        $this.parent().toggleClass('open');
381
382        if (!e.data.multiple) {
383            $el.find('.submenu').not($next).slideUp().parent().removeClass('open');
384        }
385    };
386
387    var accordion = new AccordionGetz($("div[id^='dropdownMenu'] #accordion"), false);
388
389    $("#container div[id^='dropdownMenu'] .dropdown-menu").on({
390        "click": function (e) {
391            e.stopPropagation();
392        }
393    });
394
395    //StationOrdering Menu
396    $("#header-mycart-changehost #accordion.dropdown-menu").on({
397        "click": function (e) {
398            e.stopPropagation();
399        }
400    });
401
402
403    var isiPad = navigator.userAgent.toLowerCase().indexOf("ipad");
404    if (isiPad > -1)
405    {
406        $('#getz-menu-mainsub-category ul.dropdown-menu-getz').css('overflow-x', 'visible');
407        $('#getz-menu-mainsub-category ul.dropdown-menu-getz').css('overflow-y', 'visible');
408    }
409
410});

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.