(function ($) { 'use strict' var $ = window.jQuery var Waypoint = window.Waypoint function Sticky(options) { this.options = $.extend({}, Waypoint.defaults, Sticky.defaults, options) this.element = this.options.element this.$element = $(this.element) this.createWrapper() this.createWaypoint() } Sticky.prototype.createWaypoint = function() { var originalHandler = this.options.handler this.waypoint = new Waypoint($.extend({}, this.options, { element: this.wrapper, handler: $.proxy(function(direction) { var shouldBeStuck = this.options.direction.indexOf(direction) > -1 var wrapperHeight = shouldBeStuck ? this.$element.outerHeight(true) : '' this.$wrapper.height(wrapperHeight) this.$element.toggleClass(this.options.stuckClass, shouldBeStuck) if (originalHandler) { originalHandler.call(this, direction) } }, this), offset: 0 })) } Sticky.prototype.createWrapper = function() { if (this.options.wrapper) { this.$element.wrap(this.options.wrapper) } this.$wrapper = this.$element.parent() this.wrapper = this.$wrapper[0] } Sticky.prototype.destroy = function() { if (this.$element.parent()[0] === this.wrapper) { this.waypoint.destroy() this.$element.removeClass(this.options.stuckClass) if (this.options.wrapper) { this.$element.unwrap() } } } $(document).ready(function(){ Sticky.defaults = { wrapper: '<div class="sticky-wrapper" />', stuckClass: 'stuck', direction: 'down right' } Waypoint.Sticky = Sticky }); })(jQuery);
Name | Type | Size | Permission | Actions |
---|---|---|---|---|
magnific | Folder | 0755 |
|
|
owl-carousel | Folder | 0755 |
|
|
scroll | Folder | 0755 |
|
|
select2 | Folder | 0755 |
|
|
add-to-cart.js | File | 2.76 KB | 0644 |
|
bootstrap.min.js | File | 47.76 KB | 0644 |
|
jquery.appear.js | File | 3.26 KB | 0644 |
|
jquery.cookie.js | File | 3.07 KB | 0644 |
|
main.js | File | 19.11 KB | 0644 |
|
notify.min.js | File | 13.46 KB | 0644 |
|
perfect-scrollbar.jquery.min.js | File | 24.53 KB | 0644 |
|
smooth-scroll.js | File | 22.42 KB | 0644 |
|
sticky.js | File | 1.63 KB | 0644 |
|
woocommerce.js | File | 444 B | 0644 |
|