forked from zehfernandes/jquery.fullContent
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathjquery.fullContent.min.js
executable file
·9 lines (7 loc) · 1.78 KB
/
jquery.fullContent.min.js
1
2
3
4
5
6
7
8
9
/*
* Project: Jquery FullContent
* Description: Plugin which allows a full content browser navigation. Flexible and Extended.
* Author: Zeh Fernandes | zehfernandes.com
* This plugin needs jquery.ScrollTo http://demos.flesler.com/jquery/scrollTo/ to work.
*/
(function(e,t,n){function o(n,i){this.element=n;this.$window=e(t);this.options=e.extend({},s,i);this._defaults=s;this._name=r;this.init();this.configStage()}var r="fullContent",i=t.document,s={stages:"div",idComplement:"page_",stageStart:1,speedTransition:800,mapPosition:"",ease:""};o.prototype.configStage=function(){var n=this.$window.width(),r=this.$window.height(),i=this.options.stages,s=this.options.mapPosition,o=0;e(this.element).children(i).each(function(t){e(this).css({position:"absolute",width:n,height:r});if(s[t]){var i=s[t];e(this).css({top:r*(i["v"]-1),left:n*(i["h"]-1)})}else{e(this).css({top:r*o})}o++});if(t.location.hash){var u=t.location.hash.replace(/^#\/?/,"");e.scrollTo("#"+this.options.idComplement+u,0)}};o.prototype.init=function(){var n=this,r=this.options.stages,i=this.options.idComplement;e(this.element).children(r).each(function(r){var s=e(this).attr("id");e(this).attr("id",i+s);if(!t.location.hash&&n.options.stageStart==r+1){e.scrollTo(e(this),0);t.location.hash=e(this).attr("id").replace(i,"")}});this.bind()};o.prototype.bind=function(){var n=this,r=this.options.speedTransition,i=this.options.idComplement,s=this.options.ease;this.$window.resize(function(){n.configStage()});this.$window.bind("hashchange",function(i){var o=t.location.hash.replace(/^#\/?/,"");if(s){e.scrollTo("#"+n.options.idComplement+o,r,{easing:s})}else{e.scrollTo("#"+n.options.idComplement+o,r)}})};e.fn[r]=function(t){return this.each(function(){if(!e.data(this,"plugin_"+r)){e.data(this,"plugin_"+r,new o(this,t))}})}})(jQuery,window)