From 9661f8699cdbbb4f9386527d7dd7955442c976be Mon Sep 17 00:00:00 2001 From: Nicolas Badia Date: Fri, 7 Dec 2018 08:04:43 +0100 Subject: [PATCH] Adds a minified version version and bump version to 1.0.1 --- README.md | 8 ++++---- package.json | 2 +- scroll-fixer.js | 4 ++-- scroll-fixer.min.js | 7 +++++++ 4 files changed, 14 insertions(+), 7 deletions(-) create mode 100755 scroll-fixer.min.js diff --git a/README.md b/README.md index c09998a..29878a7 100644 --- a/README.md +++ b/README.md @@ -21,11 +21,11 @@ form-submitter depends on jQuery. To use it, include this in your page : ## Usage - + $(document).ready(function() { $('.menu').scrollFixer(); }); - + ------ @@ -106,7 +106,7 @@ The DOM element. Example: - $('form').formSubmitter({ + $('form').formSubmitter({ didFix: function(evt) { console.log(this.element); } @@ -132,4 +132,4 @@ The options object. ## Copyright and license -Copyright 2013-2015 GestiXi under [The MIT License (MIT)](LICENSE). +Copyright 2012-2018 GestiXi under [The MIT License (MIT)](LICENSE). diff --git a/package.json b/package.json index bdae937..25df57e 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "scroll-fixer", - "version": "0.1.0", + "version": "1.0.1", "description": "jQuery plugin to fix element when scrolling down.", "main": "scroll-fixer.js", "scripts": { diff --git a/scroll-fixer.js b/scroll-fixer.js index 4e1da90..2f1170f 100755 --- a/scroll-fixer.js +++ b/scroll-fixer.js @@ -1,9 +1,9 @@ // ========================================================================== // Project: Scroll Fixer // Description: jQuery plugin to fix element when scrolling down -// Copyright: ©2013-2015 GestiXi +// Copyright: ©2012-2018 GestiXi // License: Licensed under the MIT license (see LICENCE) -// Version: 1.0 +// Version: 1.0.1 // Author: Nicolas BADIA // ========================================================================== diff --git a/scroll-fixer.min.js b/scroll-fixer.min.js new file mode 100755 index 0000000..e0f504e --- /dev/null +++ b/scroll-fixer.min.js @@ -0,0 +1,7 @@ +/*! scroll-fixer v1.0.1 | ©2012-2018 GestiXi | Licensed under the MIT license */ +!function(d){d.fn.scrollFixer=function(a){this.each(function(){var b=d(this),c=b.data("scrollFixerData");if(c)c.didScroll();else{var e=d.extend({},d.fn.scrollFixer.defaults,"object"==typeof a&&a);b.data("scrollFixerData",c=new f(this,e));d(window).on("touchmove",function(a){c.didScroll()});d(window).on("scroll",function(a){c.scheduleUpdate()});d(window).on("resize",function(a){c.scheduleUpdate()});c.didScroll(!0)}})};d.fn.scrollFixer.defaults={didFix:function(){},didUnfix:function(){},canFix:function(){return!0}, +marginTop:0,boxShadow:"0 2px 10px rgba(0,0,0,0.25)",zIndex:100};var f=function(a,b){this.element=a;this.options=b;var c=this.$element=d(a);this._initialTop=c.offset().top;this._initialCssTop=c.css("top");var e=this._initialCssPosition=c.css("position");this._initialBoxShadow=c.css("box-shadow");this._initialZIndex=c.css("z-index");this._placeholder=d('
');c.before(this._placeholder)};d.fn.scrollFixer.Constructor= +f;f.prototype={constructor:f,element:null,options:null,fixedElements:[],didScroll:function(a){this._didScheduleUpdate=!1;var b=d(window),c=d(document);b=b.scrollTop();0>b||b>c.height()||(0=this._placeholder.offset().top&&this.options.canFix.call(this)?this.fixElement(a):this.unfixElement())},fixElement:function(a){var b=this.$element,c=this.options,e=this.fixedElements,f=this.fixedElementsHeight(this),g=d(window).scrollTop();c.boxShadow&&(!this._hasDropShadow|| +0>=g)&&(this.resetBoxShadow(),0=b},scheduleUpdate:function(){if(!this._didScheduleUpdate)if(window.requestAnimationFrame){var a=this;this._didScheduleUpdate=!0;requestAnimationFrame(function(){a.didScroll()})}else this.didScroll()}}}(window.jQuery); \ No newline at end of file