mirror of
https://github.com/dawidolko/Website-Templates.git
synced 2026-05-11 16:00:12 +00:00
Website templates
This commit is contained in:
File diff suppressed because one or more lines are too long
@@ -0,0 +1,118 @@
|
||||
/*
|
||||
Author: webthemez.com
|
||||
Author URL: http://webthemez.com
|
||||
*/
|
||||
jQuery(function($) {
|
||||
'use strict';
|
||||
|
||||
$(window).scroll(function(event) {
|
||||
Scroll();
|
||||
});
|
||||
|
||||
$('.navbar-collapse ul li a').on('click', function() {
|
||||
$('html, body').animate({
|
||||
scrollTop: $(this.hash).offset().top - 80
|
||||
}, 1000);
|
||||
return false;
|
||||
});
|
||||
|
||||
function Scroll() {
|
||||
var contentTop = [];
|
||||
var contentBottom = [];
|
||||
var winTop = $(window).scrollTop();
|
||||
var rangeTop = 200;
|
||||
var rangeBottom = 500;
|
||||
$('.navbar-collapse').find('.scroll a').each(function() {
|
||||
contentTop.push($($(this).attr('href')).offset().top);
|
||||
contentBottom.push($($(this).attr('href')).offset().top + $($(this).attr('href')).height());
|
||||
})
|
||||
$.each(contentTop, function(i) {
|
||||
if (winTop > contentTop[i] - rangeTop) {
|
||||
$('.navbar-collapse li.scroll')
|
||||
.removeClass('active')
|
||||
.eq(i).addClass('active');
|
||||
}
|
||||
})
|
||||
};
|
||||
|
||||
$('#tohash').on('click', function() {
|
||||
$('html, body').animate({
|
||||
scrollTop: $(this.hash).offset().top - 5
|
||||
}, 1000);
|
||||
return false;
|
||||
});
|
||||
|
||||
|
||||
new WOW().init();
|
||||
|
||||
smoothScroll.init();
|
||||
|
||||
|
||||
$(window).load(function() {
|
||||
'use strict';
|
||||
var $portfolio_selectors = $('.portfolio-filter >li>a');
|
||||
var $portfolio = $('.portfolio-items');
|
||||
$portfolio.isotope({
|
||||
itemSelector: '.portfolio-item',
|
||||
layoutMode: 'fitRows'
|
||||
});
|
||||
|
||||
$portfolio_selectors.on('click', function() {
|
||||
$portfolio_selectors.removeClass('active');
|
||||
$(this).addClass('active');
|
||||
var selector = $(this).attr('data-filter');
|
||||
$portfolio.isotope({
|
||||
filter: selector
|
||||
});
|
||||
return false;
|
||||
});
|
||||
});
|
||||
|
||||
$(document).ready(function() {
|
||||
|
||||
$.fn.animateNumbers = function(stop, commas, duration, ease) {
|
||||
return this.each(function() {
|
||||
var $this = $(this);
|
||||
var start = parseInt($this.text().replace(/,/g, ""));
|
||||
commas = (commas === undefined) ? true : commas;
|
||||
$({
|
||||
value: start
|
||||
}).animate({
|
||||
value: stop
|
||||
}, {
|
||||
duration: duration == undefined ? 1000 : duration,
|
||||
easing: ease == undefined ? "swing" : ease,
|
||||
step: function() {
|
||||
$this.text(Math.floor(this.value));
|
||||
if (commas) {
|
||||
$this.text($this.text().replace(/(\d)(?=(\d\d\d)+(?!\d))/g, "$1,"));
|
||||
}
|
||||
},
|
||||
complete: function() {
|
||||
if (parseInt($this.text()) !== stop) {
|
||||
$this.text(stop);
|
||||
if (commas) {
|
||||
$this.text($this.text().replace(/(\d)(?=(\d\d\d)+(?!\d))/g, "$1,"));
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
$('.business-stats').bind('inview', function(event, visible, visiblePartX, visiblePartY) {
|
||||
var $this = $(this);
|
||||
if (visible) {
|
||||
$this.animateNumbers($this.data('digit'), false, $this.data('duration'));
|
||||
$this.unbind('inview');
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
$("a[rel^='prettyPhoto']").prettyPhoto({
|
||||
social_tools: false
|
||||
});
|
||||
|
||||
|
||||
});
|
||||
@@ -0,0 +1,8 @@
|
||||
/*
|
||||
HTML5 Shiv v3.6.2pre | @afarkas @jdalton @jon_neal @rem | MIT/GPL2 Licensed
|
||||
*/
|
||||
(function(l,f){function m(){var a=e.elements;return"string"==typeof a?a.split(" "):a}function i(a){var b=n[a[o]];b||(b={},h++,a[o]=h,n[h]=b);return b}function p(a,b,c){b||(b=f);if(g)return b.createElement(a);c||(c=i(b));b=c.cache[a]?c.cache[a].cloneNode():r.test(a)?(c.cache[a]=c.createElem(a)).cloneNode():c.createElem(a);return b.canHaveChildren&&!s.test(a)?c.frag.appendChild(b):b}function t(a,b){if(!b.cache)b.cache={},b.createElem=a.createElement,b.createFrag=a.createDocumentFragment,b.frag=b.createFrag();
|
||||
a.createElement=function(c){return!e.shivMethods?b.createElem(c):p(c,a,b)};a.createDocumentFragment=Function("h,f","return function(){var n=f.cloneNode(),c=n.createElement;h.shivMethods&&("+m().join().replace(/\w+/g,function(a){b.createElem(a);b.frag.createElement(a);return'c("'+a+'")'})+");return n}")(e,b.frag)}function q(a){a||(a=f);var b=i(a);if(e.shivCSS&&!j&&!b.hasCSS){var c,d=a;c=d.createElement("p");d=d.getElementsByTagName("head")[0]||d.documentElement;c.innerHTML="x<style>article,aside,figcaption,figure,footer,header,hgroup,nav,section{display:block}mark{background:#FF0;color:#000}</style>";
|
||||
c=d.insertBefore(c.lastChild,d.firstChild);b.hasCSS=!!c}g||t(a,b);return a}var k=l.html5||{},s=/^<|^(?:button|map|select|textarea|object|iframe|option|optgroup)$/i,r=/^(?:a|b|code|div|fieldset|h1|h2|h3|h4|h5|h6|i|label|li|ol|p|q|span|strong|style|table|tbody|td|th|tr|ul)$/i,j,o="_html5shiv",h=0,n={},g;(function(){try{var a=f.createElement("a");a.innerHTML="<xyz></xyz>";j="hidden"in a;var b;if(!(b=1==a.childNodes.length)){f.createElement("a");var c=f.createDocumentFragment();b="undefined"==typeof c.cloneNode||
|
||||
"undefined"==typeof c.createDocumentFragment||"undefined"==typeof c.createElement}g=b}catch(d){g=j=!0}})();var e={elements:k.elements||"abbr article aside audio bdi canvas data datalist details figcaption figure footer header hgroup mark meter nav output progress section summary time video",version:"3.6.2pre",shivCSS:!1!==k.shivCSS,supportsUnknownElements:g,shivMethods:!1!==k.shivMethods,type:"default",shivDocument:q,createElement:p,createDocumentFragment:function(a,b){a||(a=f);if(g)return a.createDocumentFragment();
|
||||
for(var b=b||i(a),c=b.frag.cloneNode(),d=0,e=m(),h=e.length;d<h;d++)c.createElement(e[d]);return c}};l.html5=e;q(f)})(this,document);
|
||||
@@ -0,0 +1,12 @@
|
||||
/*
|
||||
* cond - v0.1 - 6/10/2009
|
||||
* http://benalman.com/projects/jquery-cond-plugin/
|
||||
*
|
||||
* Copyright (c) 2009 "Cowboy" Ben Alman
|
||||
* Licensed under the MIT license
|
||||
* http://benalman.com/about/license/
|
||||
*
|
||||
* Based on suggestions and sample code by Stephen Band and DBJDBJ in the
|
||||
* jquery-dev Google group: http://bit.ly/jqba1
|
||||
*/
|
||||
(function($){$.fn.cond=function(){var e,a=arguments,b=0,f,d,c;while(!f&&b<a.length){f=a[b++];d=a[b++];f=$.isFunction(f)?f.call(this):f;c=!d?f:f?d.call(this,f):e}return c!==e?c:this}})(jQuery);
|
||||
@@ -0,0 +1 @@
|
||||
!function(t){function e(){var e,i,n={height:a.innerHeight,width:a.innerWidth};return n.height||(e=r.compatMode,(e||!t.support.boxModel)&&(i="CSS1Compat"===e?f:r.body,n={height:i.clientHeight,width:i.clientWidth})),n}function i(){return{top:a.pageYOffset||f.scrollTop||r.body.scrollTop,left:a.pageXOffset||f.scrollLeft||r.body.scrollLeft}}function n(){var n,l=t(),r=0;if(t.each(d,function(t,e){var i=e.data.selector,n=e.$element;l=l.add(i?n.find(i):n)}),n=l.length)for(o=o||e(),h=h||i();n>r;r++)if(t.contains(f,l[r])){var a,c,p,s=t(l[r]),u={height:s.height(),width:s.width()},g=s.offset(),v=s.data("inview");if(!h||!o)return;g.top+u.height>h.top&&g.top<h.top+o.height&&g.left+u.width>h.left&&g.left<h.left+o.width?(a=h.left>g.left?"right":h.left+o.width<g.left+u.width?"left":"both",c=h.top>g.top?"bottom":h.top+o.height<g.top+u.height?"top":"both",p=a+"-"+c,v&&v===p||s.data("inview",p).trigger("inview",[!0,a,c])):v&&s.data("inview",!1).trigger("inview",[!1])}}var o,h,l,d={},r=document,a=window,f=r.documentElement,c=t.expando;t.event.special.inview={add:function(e){d[e.guid+"-"+this[c]]={data:e,$element:t(this)},l||t.isEmptyObject(d)||(l=setInterval(n,250))},remove:function(e){try{delete d[e.guid+"-"+this[c]]}catch(i){}t.isEmptyObject(d)&&(clearInterval(l),l=null)}},t(a).bind("scroll resize scrollstop",function(){o=h=null}),!f.addEventListener&&f.attachEvent&&f.attachEvent("onfocusin",function(){h=null})}(jQuery);
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -0,0 +1,676 @@
|
||||
/**
|
||||
* jquery.slitslider.js v1.1.0
|
||||
* http://www.codrops.com
|
||||
*
|
||||
* Licensed under the MIT license.
|
||||
* http://www.opensource.org/licenses/mit-license.php
|
||||
*
|
||||
* Copyright 2012, Codrops
|
||||
* http://www.codrops.com
|
||||
*/
|
||||
|
||||
;( function( $, window, undefined ) {
|
||||
|
||||
'use strict';
|
||||
|
||||
/*
|
||||
* debouncedresize: special jQuery event that happens once after a window resize
|
||||
*
|
||||
* latest version and complete README available on Github:
|
||||
* https://github.com/louisremi/jquery-smartresize/blob/master/jquery.debouncedresize.js
|
||||
*
|
||||
* Copyright 2011 @louis_remi
|
||||
* Licensed under the MIT license.
|
||||
*/
|
||||
var $event = $.event,
|
||||
$special,
|
||||
resizeTimeout;
|
||||
|
||||
$special = $event.special.debouncedresize = {
|
||||
setup: function() {
|
||||
$( this ).on( "resize", $special.handler );
|
||||
},
|
||||
teardown: function() {
|
||||
$( this ).off( "resize", $special.handler );
|
||||
},
|
||||
handler: function( event, execAsap ) {
|
||||
// Save the context
|
||||
var context = this,
|
||||
args = arguments,
|
||||
dispatch = function() {
|
||||
// set correct event type
|
||||
event.type = "debouncedresize";
|
||||
$event.dispatch.apply( context, args );
|
||||
};
|
||||
|
||||
if ( resizeTimeout ) {
|
||||
clearTimeout( resizeTimeout );
|
||||
}
|
||||
|
||||
execAsap ?
|
||||
dispatch() :
|
||||
resizeTimeout = setTimeout( dispatch, $special.threshold );
|
||||
},
|
||||
threshold: 20
|
||||
};
|
||||
|
||||
// global
|
||||
var $window = $( window ),
|
||||
$document = $( document ),
|
||||
Modernizr = window.Modernizr;
|
||||
|
||||
$.Slitslider = function( options, element ) {
|
||||
|
||||
this.$elWrapper = $( element );
|
||||
this._init( options );
|
||||
|
||||
};
|
||||
|
||||
$.Slitslider.defaults = {
|
||||
// transitions speed
|
||||
speed : 800,
|
||||
// if true the item's slices will also animate the opacity value
|
||||
optOpacity : false,
|
||||
// amount (%) to translate both slices - adjust as necessary
|
||||
translateFactor : 230,
|
||||
// maximum possible angle
|
||||
maxAngle : 25,
|
||||
// maximum possible scale
|
||||
maxScale : 2,
|
||||
// slideshow on / off
|
||||
autoplay : false,
|
||||
// keyboard navigation
|
||||
keyboard : true,
|
||||
// time between transitions
|
||||
interval : 4000,
|
||||
// callbacks
|
||||
onBeforeChange : function( slide, idx ) { return false; },
|
||||
onAfterChange : function( slide, idx ) { return false; }
|
||||
};
|
||||
|
||||
$.Slitslider.prototype = {
|
||||
|
||||
_init : function( options ) {
|
||||
|
||||
// options
|
||||
this.options = $.extend( true, {}, $.Slitslider.defaults, options );
|
||||
|
||||
// https://github.com/twitter/bootstrap/issues/2870
|
||||
this.transEndEventNames = {
|
||||
'WebkitTransition' : 'webkitTransitionEnd',
|
||||
'MozTransition' : 'transitionend',
|
||||
'OTransition' : 'oTransitionEnd',
|
||||
'msTransition' : 'MSTransitionEnd',
|
||||
'transition' : 'transitionend'
|
||||
};
|
||||
this.transEndEventName = this.transEndEventNames[ Modernizr.prefixed( 'transition' ) ];
|
||||
// suport for css 3d transforms and css transitions
|
||||
this.support = Modernizr.csstransitions && Modernizr.csstransforms3d;
|
||||
// the slider
|
||||
this.$el = this.$elWrapper.children( '.sl-slider' );
|
||||
// the slides
|
||||
this.$slides = this.$el.children( '.sl-slide' ).hide();
|
||||
// total slides
|
||||
this.slidesCount = this.$slides.length;
|
||||
// current slide
|
||||
this.current = 0;
|
||||
// control if it's animating
|
||||
this.isAnimating = false;
|
||||
// get container size
|
||||
this._getSize();
|
||||
// layout
|
||||
this._layout();
|
||||
// load some events
|
||||
this._loadEvents();
|
||||
// slideshow
|
||||
if( this.options.autoplay ) {
|
||||
|
||||
this._startSlideshow();
|
||||
|
||||
}
|
||||
|
||||
},
|
||||
// gets the current container width & height
|
||||
_getSize : function() {
|
||||
|
||||
this.size = {
|
||||
width : this.$elWrapper.outerWidth( true ),
|
||||
height : this.$elWrapper.outerHeight( true )
|
||||
};
|
||||
|
||||
},
|
||||
_layout : function() {
|
||||
|
||||
this.$slideWrapper = $( '<div class="sl-slides-wrapper" />' );
|
||||
|
||||
// wrap the slides
|
||||
this.$slides.wrapAll( this.$slideWrapper ).each( function( i ) {
|
||||
|
||||
var $slide = $( this ),
|
||||
// vertical || horizontal
|
||||
orientation = $slide.data( 'orientation' );
|
||||
|
||||
$slide.addClass( 'sl-slide-' + orientation )
|
||||
.children()
|
||||
.wrapAll( '<div class="sl-content-wrapper" />' )
|
||||
.wrapAll( '<div class="sl-content" />' );
|
||||
|
||||
} );
|
||||
|
||||
// set the right size of the slider/slides for the current window size
|
||||
this._setSize();
|
||||
// show first slide
|
||||
this.$slides.eq( this.current ).show();
|
||||
|
||||
},
|
||||
_navigate : function( dir, pos ) {
|
||||
|
||||
if( this.isAnimating || this.slidesCount < 2 ) {
|
||||
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
this.isAnimating = true;
|
||||
|
||||
var self = this,
|
||||
$currentSlide = this.$slides.eq( this.current );
|
||||
|
||||
// if position is passed
|
||||
if( pos !== undefined ) {
|
||||
|
||||
this.current = pos;
|
||||
|
||||
}
|
||||
// if not check the boundaries
|
||||
else if( dir === 'next' ) {
|
||||
|
||||
this.current = this.current < this.slidesCount - 1 ? ++this.current : 0;
|
||||
|
||||
}
|
||||
else if( dir === 'prev' ) {
|
||||
|
||||
this.current = this.current > 0 ? --this.current : this.slidesCount - 1;
|
||||
|
||||
}
|
||||
|
||||
this.options.onBeforeChange( $currentSlide, this.current );
|
||||
|
||||
// next slide to be shown
|
||||
var $nextSlide = this.$slides.eq( this.current ),
|
||||
// the slide we want to cut and animate
|
||||
$movingSlide = ( dir === 'next' ) ? $currentSlide : $nextSlide,
|
||||
|
||||
// the following are the data attrs set for each slide
|
||||
configData = $movingSlide.data(),
|
||||
config = {};
|
||||
|
||||
config.orientation = configData.orientation || 'horizontal',
|
||||
config.slice1angle = configData.slice1Rotation || 0,
|
||||
config.slice1scale = configData.slice1Scale || 1,
|
||||
config.slice2angle = configData.slice2Rotation || 0,
|
||||
config.slice2scale = configData.slice2Scale || 1;
|
||||
|
||||
this._validateValues( config );
|
||||
|
||||
var cssStyle = config.orientation === 'horizontal' ? {
|
||||
marginTop : -this.size.height / 2
|
||||
} : {
|
||||
marginLeft : -this.size.width / 2
|
||||
},
|
||||
// default slide's slices style
|
||||
resetStyle = {
|
||||
'transform' : 'translate(0%,0%) rotate(0deg) scale(1)',
|
||||
opacity : 1
|
||||
},
|
||||
// slice1 style
|
||||
slice1Style = config.orientation === 'horizontal' ? {
|
||||
'transform' : 'translateY(-' + this.options.translateFactor + '%) rotate(' + config.slice1angle + 'deg) scale(' + config.slice1scale + ')'
|
||||
} : {
|
||||
'transform' : 'translateX(-' + this.options.translateFactor + '%) rotate(' + config.slice1angle + 'deg) scale(' + config.slice1scale + ')'
|
||||
},
|
||||
// slice2 style
|
||||
slice2Style = config.orientation === 'horizontal' ? {
|
||||
'transform' : 'translateY(' + this.options.translateFactor + '%) rotate(' + config.slice2angle + 'deg) scale(' + config.slice2scale + ')'
|
||||
} : {
|
||||
'transform' : 'translateX(' + this.options.translateFactor + '%) rotate(' + config.slice2angle + 'deg) scale(' + config.slice2scale + ')'
|
||||
};
|
||||
|
||||
if( this.options.optOpacity ) {
|
||||
|
||||
slice1Style.opacity = 0;
|
||||
slice2Style.opacity = 0;
|
||||
|
||||
}
|
||||
|
||||
// we are adding the classes sl-trans-elems and sl-trans-back-elems to the slide that is either coming "next"
|
||||
// or going "prev" according to the direction.
|
||||
// the idea is to make it more interesting by giving some animations to the respective slide's elements
|
||||
//( dir === 'next' ) ? $nextSlide.addClass( 'sl-trans-elems' ) : $currentSlide.addClass( 'sl-trans-back-elems' );
|
||||
|
||||
$currentSlide.removeClass( 'sl-trans-elems' );
|
||||
|
||||
var transitionProp = {
|
||||
'transition' : 'all ' + this.options.speed + 'ms ease-in-out'
|
||||
};
|
||||
|
||||
// add the 2 slices and animate them
|
||||
$movingSlide.css( 'z-index', this.slidesCount )
|
||||
.find( 'div.sl-content-wrapper' )
|
||||
.wrap( $( '<div class="sl-content-slice" />' ).css( transitionProp ) )
|
||||
.parent()
|
||||
.cond(
|
||||
dir === 'prev',
|
||||
function() {
|
||||
|
||||
var slice = this;
|
||||
this.css( slice1Style );
|
||||
setTimeout( function() {
|
||||
|
||||
slice.css( resetStyle );
|
||||
|
||||
}, 50 );
|
||||
|
||||
},
|
||||
function() {
|
||||
|
||||
var slice = this;
|
||||
setTimeout( function() {
|
||||
|
||||
slice.css( slice1Style );
|
||||
|
||||
}, 50 );
|
||||
|
||||
}
|
||||
)
|
||||
.clone()
|
||||
.appendTo( $movingSlide )
|
||||
.cond(
|
||||
dir === 'prev',
|
||||
function() {
|
||||
|
||||
var slice = this;
|
||||
this.css( slice2Style );
|
||||
setTimeout( function() {
|
||||
|
||||
$currentSlide.addClass( 'sl-trans-back-elems' );
|
||||
|
||||
if( self.support ) {
|
||||
|
||||
slice.css( resetStyle ).on( self.transEndEventName, function() {
|
||||
|
||||
self._onEndNavigate( slice, $currentSlide, dir );
|
||||
|
||||
} );
|
||||
|
||||
}
|
||||
else {
|
||||
|
||||
self._onEndNavigate( slice, $currentSlide, dir );
|
||||
|
||||
}
|
||||
|
||||
}, 50 );
|
||||
|
||||
},
|
||||
function() {
|
||||
|
||||
var slice = this;
|
||||
setTimeout( function() {
|
||||
|
||||
$nextSlide.addClass( 'sl-trans-elems' );
|
||||
|
||||
if( self.support ) {
|
||||
|
||||
slice.css( slice2Style ).on( self.transEndEventName, function() {
|
||||
|
||||
self._onEndNavigate( slice, $currentSlide, dir );
|
||||
|
||||
} );
|
||||
|
||||
}
|
||||
else {
|
||||
|
||||
self._onEndNavigate( slice, $currentSlide, dir );
|
||||
|
||||
}
|
||||
|
||||
}, 50 );
|
||||
|
||||
}
|
||||
)
|
||||
.find( 'div.sl-content-wrapper' )
|
||||
.css( cssStyle );
|
||||
|
||||
$nextSlide.show();
|
||||
|
||||
},
|
||||
_validateValues : function( config ) {
|
||||
|
||||
// OK, so we are restricting the angles and scale values here.
|
||||
// This is to avoid the slices wrong sides to be shown.
|
||||
// you can adjust these values as you wish but make sure you also ajust the
|
||||
// paddings of the slides and also the options.translateFactor value and scale data attrs
|
||||
if( config.slice1angle > this.options.maxAngle || config.slice1angle < -this.options.maxAngle ) {
|
||||
|
||||
config.slice1angle = this.options.maxAngle;
|
||||
|
||||
}
|
||||
if( config.slice2angle > this.options.maxAngle || config.slice2angle < -this.options.maxAngle ) {
|
||||
|
||||
config.slice2angle = this.options.maxAngle;
|
||||
|
||||
}
|
||||
if( config.slice1scale > this.options.maxScale || config.slice1scale <= 0 ) {
|
||||
|
||||
config.slice1scale = this.options.maxScale;
|
||||
|
||||
}
|
||||
if( config.slice2scale > this.options.maxScale || config.slice2scale <= 0 ) {
|
||||
|
||||
config.slice2scale = this.options.maxScale;
|
||||
|
||||
}
|
||||
if( config.orientation !== 'vertical' && config.orientation !== 'horizontal' ) {
|
||||
|
||||
config.orientation = 'horizontal'
|
||||
|
||||
}
|
||||
|
||||
},
|
||||
_onEndNavigate : function( $slice, $oldSlide, dir ) {
|
||||
|
||||
// reset previous slide's style after next slide is shown
|
||||
var $slide = $slice.parent(),
|
||||
removeClasses = 'sl-trans-elems sl-trans-back-elems';
|
||||
|
||||
// remove second slide's slice
|
||||
$slice.remove();
|
||||
// unwrap..
|
||||
$slide.css( 'z-index', 1 )
|
||||
.find( 'div.sl-content-wrapper' )
|
||||
.unwrap();
|
||||
|
||||
// hide previous current slide
|
||||
$oldSlide.hide().removeClass( removeClasses );
|
||||
$slide.removeClass( removeClasses );
|
||||
// now we can navigate again..
|
||||
this.isAnimating = false;
|
||||
this.options.onAfterChange( $slide, this.current );
|
||||
|
||||
},
|
||||
_setSize : function() {
|
||||
|
||||
// the slider and content wrappers will have the window's width and height
|
||||
var cssStyle = {
|
||||
width : this.size.width,
|
||||
height : this.size.height
|
||||
};
|
||||
|
||||
this.$el.css( cssStyle ).find( 'div.sl-content-wrapper' ).css( cssStyle );
|
||||
|
||||
},
|
||||
_loadEvents : function() {
|
||||
|
||||
var self = this;
|
||||
|
||||
$window.on( 'debouncedresize.slitslider', function( event ) {
|
||||
|
||||
// update size values
|
||||
self._getSize();
|
||||
// set the sizes again
|
||||
self._setSize();
|
||||
|
||||
} );
|
||||
|
||||
if ( this.options.keyboard ) {
|
||||
|
||||
$document.on( 'keydown.slitslider', function(e) {
|
||||
|
||||
var keyCode = e.keyCode || e.which,
|
||||
arrow = {
|
||||
left: 37,
|
||||
up: 38,
|
||||
right: 39,
|
||||
down: 40
|
||||
};
|
||||
|
||||
switch (keyCode) {
|
||||
|
||||
case arrow.left :
|
||||
|
||||
self._stopSlideshow();
|
||||
self._navigate( 'prev' );
|
||||
break;
|
||||
|
||||
case arrow.right :
|
||||
|
||||
self._stopSlideshow();
|
||||
self._navigate( 'next' );
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
} );
|
||||
|
||||
}
|
||||
|
||||
},
|
||||
_startSlideshow: function() {
|
||||
|
||||
var self = this;
|
||||
|
||||
this.slideshow = setTimeout( function() {
|
||||
|
||||
self._navigate( 'next' );
|
||||
|
||||
if ( self.options.autoplay ) {
|
||||
|
||||
self._startSlideshow();
|
||||
|
||||
}
|
||||
|
||||
}, this.options.interval );
|
||||
|
||||
},
|
||||
_stopSlideshow: function() {
|
||||
|
||||
if ( this.options.autoplay ) {
|
||||
|
||||
clearTimeout( this.slideshow );
|
||||
this.isPlaying = false;
|
||||
this.options.autoplay = false;
|
||||
|
||||
}
|
||||
|
||||
},
|
||||
_destroy : function( callback ) {
|
||||
|
||||
this.$el.off( '.slitslider' ).removeData( 'slitslider' );
|
||||
$window.off( '.slitslider' );
|
||||
$document.off( '.slitslider' );
|
||||
this.$slides.each( function( i ) {
|
||||
|
||||
var $slide = $( this ),
|
||||
$content = $slide.find( 'div.sl-content' ).children();
|
||||
|
||||
$content.appendTo( $slide );
|
||||
$slide.children( 'div.sl-content-wrapper' ).remove();
|
||||
|
||||
} );
|
||||
this.$slides.unwrap( this.$slideWrapper ).hide();
|
||||
this.$slides.eq( 0 ).show();
|
||||
if( callback ) {
|
||||
|
||||
callback.call();
|
||||
|
||||
}
|
||||
|
||||
},
|
||||
// public methos: adds more slides to the slider
|
||||
add : function( $slides, callback ) {
|
||||
|
||||
this.$slides = this.$slides.add( $slides );
|
||||
|
||||
var self = this;
|
||||
|
||||
|
||||
$slides.each( function( i ) {
|
||||
|
||||
var $slide = $( this ),
|
||||
// vertical || horizontal
|
||||
orientation = $slide.data( 'orientation' );
|
||||
|
||||
$slide.hide().addClass( 'sl-slide-' + orientation )
|
||||
.children()
|
||||
.wrapAll( '<div class="sl-content-wrapper" />' )
|
||||
.wrapAll( '<div class="sl-content" />' )
|
||||
.end()
|
||||
.appendTo( self.$el.find( 'div.sl-slides-wrapper' ) );
|
||||
|
||||
} );
|
||||
|
||||
this._setSize();
|
||||
|
||||
this.slidesCount = this.$slides.length;
|
||||
|
||||
if ( callback ) {
|
||||
|
||||
callback.call( $items );
|
||||
|
||||
}
|
||||
|
||||
},
|
||||
// public method: shows next slide
|
||||
next : function() {
|
||||
|
||||
this._stopSlideshow();
|
||||
this._navigate( 'next' );
|
||||
|
||||
},
|
||||
// public method: shows previous slide
|
||||
previous : function() {
|
||||
|
||||
this._stopSlideshow();
|
||||
this._navigate( 'prev' );
|
||||
|
||||
},
|
||||
// public method: goes to a specific slide
|
||||
jump : function( pos ) {
|
||||
|
||||
pos -= 1;
|
||||
|
||||
if( pos === this.current || pos >= this.slidesCount || pos < 0 ) {
|
||||
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
this._stopSlideshow();
|
||||
this._navigate( pos > this.current ? 'next' : 'prev', pos );
|
||||
|
||||
},
|
||||
// public method: starts the slideshow
|
||||
// any call to next(), previous() or jump() will stop the slideshow
|
||||
play : function() {
|
||||
|
||||
if( !this.isPlaying ) {
|
||||
|
||||
this.isPlaying = true;
|
||||
|
||||
this._navigate( 'next' );
|
||||
this.options.autoplay = true;
|
||||
this._startSlideshow();
|
||||
|
||||
}
|
||||
|
||||
},
|
||||
// public method: pauses the slideshow
|
||||
pause : function() {
|
||||
|
||||
if( this.isPlaying ) {
|
||||
|
||||
this._stopSlideshow();
|
||||
|
||||
}
|
||||
|
||||
},
|
||||
// public method: check if isAnimating is true
|
||||
isActive : function() {
|
||||
|
||||
return this.isAnimating;
|
||||
|
||||
},
|
||||
// publicc methos: destroys the slicebox instance
|
||||
destroy : function( callback ) {
|
||||
|
||||
this._destroy( callback );
|
||||
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
var logError = function( message ) {
|
||||
|
||||
if ( window.console ) {
|
||||
|
||||
window.console.error( message );
|
||||
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
$.fn.slitslider = function( options ) {
|
||||
|
||||
var self = $.data( this, 'slitslider' );
|
||||
|
||||
if ( typeof options === 'string' ) {
|
||||
|
||||
var args = Array.prototype.slice.call( arguments, 1 );
|
||||
|
||||
this.each(function() {
|
||||
|
||||
if ( !self ) {
|
||||
|
||||
logError( "cannot call methods on slitslider prior to initialization; " +
|
||||
"attempted to call method '" + options + "'" );
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
if ( !$.isFunction( self[options] ) || options.charAt(0) === "_" ) {
|
||||
|
||||
logError( "no such method '" + options + "' for slitslider self" );
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
self[ options ].apply( self, args );
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
else {
|
||||
|
||||
this.each(function() {
|
||||
|
||||
if ( self ) {
|
||||
|
||||
self._init();
|
||||
|
||||
}
|
||||
else {
|
||||
|
||||
self = $.data( this, 'slitslider', new $.Slitslider( options, this ) );
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
return self;
|
||||
|
||||
};
|
||||
|
||||
} )( jQuery, window );
|
||||
File diff suppressed because one or more lines are too long
@@ -0,0 +1,290 @@
|
||||
(function (root, factory) {
|
||||
if ( typeof define === 'function' && define.amd ) {
|
||||
define('smoothScroll', factory(root));
|
||||
} else if ( typeof exports === 'object' ) {
|
||||
module.smoothScroll = factory(root);
|
||||
} else {
|
||||
root.smoothScroll = factory(root);
|
||||
}
|
||||
})(this, function (root) {
|
||||
|
||||
'use strict';
|
||||
|
||||
//
|
||||
// Variables
|
||||
//
|
||||
|
||||
var exports = {}; // Object for public APIs
|
||||
var supports = !!document.querySelector && !!root.addEventListener; // Feature test
|
||||
var settings;
|
||||
|
||||
// Default settings
|
||||
var defaults = {
|
||||
speed: 500,
|
||||
easing: 'easeInOutCubic',
|
||||
offset: 0,
|
||||
updateURL: false,
|
||||
callbackBefore: function () {},
|
||||
callbackAfter: function () {}
|
||||
};
|
||||
|
||||
|
||||
//
|
||||
// Methods
|
||||
//
|
||||
|
||||
/**
|
||||
* A simple forEach() implementation for Arrays, Objects and NodeLists
|
||||
* @private
|
||||
* @param {Array|Object|NodeList} collection Collection of items to iterate
|
||||
* @param {Function} callback Callback function for each iteration
|
||||
* @param {Array|Object|NodeList} scope Object/NodeList/Array that forEach is iterating over (aka `this`)
|
||||
*/
|
||||
var forEach = function (collection, callback, scope) {
|
||||
if (Object.prototype.toString.call(collection) === '[object Object]') {
|
||||
for (var prop in collection) {
|
||||
if (Object.prototype.hasOwnProperty.call(collection, prop)) {
|
||||
callback.call(scope, collection[prop], prop, collection);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
for (var i = 0, len = collection.length; i < len; i++) {
|
||||
callback.call(scope, collection[i], i, collection);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Merge defaults with user options
|
||||
* @private
|
||||
* @param {Object} defaults Default settings
|
||||
* @param {Object} options User options
|
||||
* @returns {Object} Merged values of defaults and options
|
||||
*/
|
||||
var extend = function ( defaults, options ) {
|
||||
var extended = {};
|
||||
forEach(defaults, function (value, prop) {
|
||||
extended[prop] = defaults[prop];
|
||||
});
|
||||
forEach(options, function (value, prop) {
|
||||
extended[prop] = options[prop];
|
||||
});
|
||||
return extended;
|
||||
};
|
||||
|
||||
/**
|
||||
* Calculate the easing pattern
|
||||
* @private
|
||||
* @param {String} type Easing pattern
|
||||
* @param {Number} time Time animation should take to complete
|
||||
* @returns {Number}
|
||||
*/
|
||||
var easingPattern = function ( type, time ) {
|
||||
var pattern;
|
||||
if ( type === 'easeInQuad' ) pattern = time * time; // accelerating from zero velocity
|
||||
if ( type === 'easeOutQuad' ) pattern = time * (2 - time); // decelerating to zero velocity
|
||||
if ( type === 'easeInOutQuad' ) pattern = time < 0.5 ? 2 * time * time : -1 + (4 - 2 * time) * time; // acceleration until halfway, then deceleration
|
||||
if ( type === 'easeInCubic' ) pattern = time * time * time; // accelerating from zero velocity
|
||||
if ( type === 'easeOutCubic' ) pattern = (--time) * time * time + 1; // decelerating to zero velocity
|
||||
if ( type === 'easeInOutCubic' ) pattern = time < 0.5 ? 4 * time * time * time : (time - 1) * (2 * time - 2) * (2 * time - 2) + 1; // acceleration until halfway, then deceleration
|
||||
if ( type === 'easeInQuart' ) pattern = time * time * time * time; // accelerating from zero velocity
|
||||
if ( type === 'easeOutQuart' ) pattern = 1 - (--time) * time * time * time; // decelerating to zero velocity
|
||||
if ( type === 'easeInOutQuart' ) pattern = time < 0.5 ? 8 * time * time * time * time : 1 - 8 * (--time) * time * time * time; // acceleration until halfway, then deceleration
|
||||
if ( type === 'easeInQuint' ) pattern = time * time * time * time * time; // accelerating from zero velocity
|
||||
if ( type === 'easeOutQuint' ) pattern = 1 + (--time) * time * time * time * time; // decelerating to zero velocity
|
||||
if ( type === 'easeInOutQuint' ) pattern = time < 0.5 ? 16 * time * time * time * time * time : 1 + 16 * (--time) * time * time * time * time; // acceleration until halfway, then deceleration
|
||||
return pattern || time; // no easing, no acceleration
|
||||
};
|
||||
|
||||
/**
|
||||
* Calculate how far to scroll
|
||||
* @private
|
||||
* @param {Element} anchor The anchor element to scroll to
|
||||
* @param {Number} headerHeight Height of a fixed header, if any
|
||||
* @param {Number} offset Number of pixels by which to offset scroll
|
||||
* @returns {Number}
|
||||
*/
|
||||
var getEndLocation = function ( anchor, headerHeight, offset ) {
|
||||
var location = 0;
|
||||
if (anchor.offsetParent) {
|
||||
do {
|
||||
location += anchor.offsetTop;
|
||||
anchor = anchor.offsetParent;
|
||||
} while (anchor);
|
||||
}
|
||||
location = location - headerHeight - offset;
|
||||
return location >= 0 ? location : 0;
|
||||
};
|
||||
|
||||
/**
|
||||
* Determine the document's height
|
||||
* @private
|
||||
* @returns {Number}
|
||||
*/
|
||||
var getDocumentHeight = function () {
|
||||
return Math.max(
|
||||
document.body.scrollHeight, document.documentElement.scrollHeight,
|
||||
document.body.offsetHeight, document.documentElement.offsetHeight,
|
||||
document.body.clientHeight, document.documentElement.clientHeight
|
||||
);
|
||||
};
|
||||
|
||||
/**
|
||||
* Remove whitespace from a string
|
||||
* @private
|
||||
* @param {String} string
|
||||
* @returns {String}
|
||||
*/
|
||||
var trim = function ( string ) {
|
||||
return string.replace(/^\s+|\s+$/g, '');
|
||||
};
|
||||
|
||||
/**
|
||||
* Convert data-options attribute into an object of key/value pairs
|
||||
* @private
|
||||
* @param {String} options Link-specific options as a data attribute string
|
||||
* @returns {Object}
|
||||
*/
|
||||
var getDataOptions = function ( options ) {
|
||||
var settings = {};
|
||||
// Create a key/value pair for each setting
|
||||
if ( options ) {
|
||||
options = options.split(';');
|
||||
options.forEach( function(option) {
|
||||
option = trim(option);
|
||||
if ( option !== '' ) {
|
||||
option = option.split(':');
|
||||
settings[option[0]] = trim(option[1]);
|
||||
}
|
||||
});
|
||||
}
|
||||
return settings;
|
||||
};
|
||||
|
||||
/**
|
||||
* Update the URL
|
||||
* @private
|
||||
* @param {Element} anchor The element to scroll to
|
||||
* @param {Boolean} url Whether or not to update the URL history
|
||||
*/
|
||||
var updateUrl = function ( anchor, url ) {
|
||||
if ( history.pushState && (url || url === 'true') ) {
|
||||
history.pushState( {
|
||||
pos: anchor.id
|
||||
}, '', anchor );
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Start/stop the scrolling animation
|
||||
* @public
|
||||
* @param {Element} toggle The element that toggled the scroll event
|
||||
* @param {Element} anchor The element to scroll to
|
||||
* @param {Object} settings
|
||||
* @param {Event} event
|
||||
*/
|
||||
exports.animateScroll = function ( toggle, anchor, options, event ) {
|
||||
|
||||
// Options and overrides
|
||||
var settings = extend( settings || defaults, options || {} ); // Merge user options with defaults
|
||||
var overrides = getDataOptions( toggle ? toggle.getAttribute('data-options') : null );
|
||||
settings = extend( settings, overrides );
|
||||
|
||||
// Selectors and variables
|
||||
var fixedHeader = document.querySelector('[data-scroll-header]'); // Get the fixed header
|
||||
var headerHeight = fixedHeader === null ? 0 : (fixedHeader.offsetHeight + fixedHeader.offsetTop); // Get the height of a fixed header if one exists
|
||||
var startLocation = root.pageYOffset; // Current location on the page
|
||||
var endLocation = getEndLocation( document.querySelector(anchor), headerHeight, parseInt(settings.offset, 10) ); // Scroll to location
|
||||
var animationInterval; // interval timer
|
||||
var distance = endLocation - startLocation; // distance to travel
|
||||
var documentHeight = getDocumentHeight();
|
||||
var timeLapsed = 0;
|
||||
var percentage, position;
|
||||
|
||||
// Prevent default click event
|
||||
if ( toggle && toggle.tagName.toLowerCase() === 'a' && event ) {
|
||||
event.preventDefault();
|
||||
}
|
||||
|
||||
// Update URL
|
||||
updateUrl(anchor, settings.updateURL);
|
||||
|
||||
/**
|
||||
* Stop the scroll animation when it reaches its target (or the bottom/top of page)
|
||||
* @private
|
||||
* @param {Number} position Current position on the page
|
||||
* @param {Number} endLocation Scroll to location
|
||||
* @param {Number} animationInterval How much to scroll on this loop
|
||||
*/
|
||||
var stopAnimateScroll = function (position, endLocation, animationInterval) {
|
||||
var currentLocation = root.pageYOffset;
|
||||
if ( position == endLocation || currentLocation == endLocation || ( (root.innerHeight + currentLocation) >= documentHeight ) ) {
|
||||
clearInterval(animationInterval);
|
||||
settings.callbackAfter( toggle, anchor ); // Run callbacks after animation complete
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Loop scrolling animation
|
||||
* @private
|
||||
*/
|
||||
var loopAnimateScroll = function () {
|
||||
timeLapsed += 16;
|
||||
percentage = ( timeLapsed / parseInt(settings.speed, 10) );
|
||||
percentage = ( percentage > 1 ) ? 1 : percentage;
|
||||
position = startLocation + ( distance * easingPattern(settings.easing, percentage) );
|
||||
root.scrollTo( 0, Math.floor(position) );
|
||||
stopAnimateScroll(position, endLocation, animationInterval);
|
||||
};
|
||||
|
||||
/**
|
||||
* Set interval timer
|
||||
* @private
|
||||
*/
|
||||
var startAnimateScroll = function () {
|
||||
settings.callbackBefore( toggle, anchor ); // Run callbacks before animating scroll
|
||||
animationInterval = setInterval(loopAnimateScroll, 16);
|
||||
};
|
||||
|
||||
/**
|
||||
* Reset position to fix weird iOS bug
|
||||
* @link https://github.com/cferdinandi/smooth-scroll/issues/45
|
||||
*/
|
||||
if ( root.pageYOffset === 0 ) {
|
||||
root.scrollTo( 0, 0 );
|
||||
}
|
||||
|
||||
// Start scrolling animation
|
||||
startAnimateScroll();
|
||||
|
||||
};
|
||||
|
||||
/**
|
||||
* Initialize Smooth Scroll
|
||||
* @public
|
||||
* @param {Object} options User settings
|
||||
*/
|
||||
exports.init = function ( options ) {
|
||||
|
||||
// feature test
|
||||
if ( !supports ) return;
|
||||
|
||||
// Selectors and variables
|
||||
settings = extend( defaults, options || {} ); // Merge user options with defaults
|
||||
var toggles = document.querySelectorAll('[data-scroll]'); // Get smooth scroll toggles
|
||||
|
||||
// When a toggle is clicked, run the click handler
|
||||
forEach(toggles, function (toggle) {
|
||||
toggle.addEventListener('click', exports.animateScroll.bind( null, toggle, toggle.hash, settings ), false);
|
||||
});
|
||||
|
||||
};
|
||||
|
||||
|
||||
//
|
||||
// Public APIs
|
||||
//
|
||||
|
||||
return exports;
|
||||
|
||||
});
|
||||
@@ -0,0 +1,6 @@
|
||||
/*! matchMedia() polyfill - Test a CSS media type/query in JS. Authors & copyright (c) 2012: Scott Jehl, Paul Irish, Nicholas Zakas. Dual MIT/BSD license */
|
||||
/*! NOTE: If you're already including a window.matchMedia polyfill via Modernizr or otherwise, you don't need this part */
|
||||
window.matchMedia=window.matchMedia||function(a){"use strict";var c,d=a.documentElement,e=d.firstElementChild||d.firstChild,f=a.createElement("body"),g=a.createElement("div");return g.id="mq-test-1",g.style.cssText="position:absolute;top:-100em",f.style.background="none",f.appendChild(g),function(a){return g.innerHTML='­<style media="'+a+'"> #mq-test-1 { width: 42px; }</style>',d.insertBefore(f,e),c=42===g.offsetWidth,d.removeChild(f),{matches:c,media:a}}}(document);
|
||||
|
||||
/*! Respond.js v1.1.0: min/max-width media query polyfill. (c) Scott Jehl. MIT/GPLv2 Lic. j.mp/respondjs */
|
||||
(function(a){"use strict";function x(){u(!0)}var b={};a.respond=b,b.update=function(){},b.mediaQueriesSupported=a.matchMedia&&a.matchMedia("only all").matches,b.mediaQueriesSupported;var q,r,t,c=a.document,d=c.documentElement,e=[],f=[],g=[],h={},i=30,j=c.getElementsByTagName("head")[0]||d,k=c.getElementsByTagName("base")[0],l=j.getElementsByTagName("link"),m=[],n=function(){for(var b=0;l.length>b;b++){var c=l[b],d=c.href,e=c.media,f=c.rel&&"stylesheet"===c.rel.toLowerCase();d&&f&&!h[d]&&(c.styleSheet&&c.styleSheet.rawCssText?(p(c.styleSheet.rawCssText,d,e),h[d]=!0):(!/^([a-zA-Z:]*\/\/)/.test(d)&&!k||d.replace(RegExp.$1,"").split("/")[0]===a.location.host)&&m.push({href:d,media:e}))}o()},o=function(){if(m.length){var a=m.shift();v(a.href,function(b){p(b,a.href,a.media),h[a.href]=!0,setTimeout(function(){o()},0)})}},p=function(a,b,c){var d=a.match(/@media[^\{]+\{([^\{\}]*\{[^\}\{]*\})+/gi),g=d&&d.length||0;b=b.substring(0,b.lastIndexOf("/"));var h=function(a){return a.replace(/(url\()['"]?([^\/\)'"][^:\)'"]+)['"]?(\))/g,"$1"+b+"$2$3")},i=!g&&c;b.length&&(b+="/"),i&&(g=1);for(var j=0;g>j;j++){var k,l,m,n;i?(k=c,f.push(h(a))):(k=d[j].match(/@media *([^\{]+)\{([\S\s]+?)$/)&&RegExp.$1,f.push(RegExp.$2&&h(RegExp.$2))),m=k.split(","),n=m.length;for(var o=0;n>o;o++)l=m[o],e.push({media:l.split("(")[0].match(/(only\s+)?([a-zA-Z]+)\s?/)&&RegExp.$2||"all",rules:f.length-1,hasquery:l.indexOf("(")>-1,minw:l.match(/\(min\-width:[\s]*([\s]*[0-9\.]+)(px|em)[\s]*\)/)&&parseFloat(RegExp.$1)+(RegExp.$2||""),maxw:l.match(/\(max\-width:[\s]*([\s]*[0-9\.]+)(px|em)[\s]*\)/)&&parseFloat(RegExp.$1)+(RegExp.$2||"")})}u()},s=function(){var a,b=c.createElement("div"),e=c.body,f=!1;return b.style.cssText="position:absolute;font-size:1em;width:1em",e||(e=f=c.createElement("body"),e.style.background="none"),e.appendChild(b),d.insertBefore(e,d.firstChild),a=b.offsetWidth,f?d.removeChild(e):e.removeChild(b),a=t=parseFloat(a)},u=function(a){var b="clientWidth",h=d[b],k="CSS1Compat"===c.compatMode&&h||c.body[b]||h,m={},n=l[l.length-1],o=(new Date).getTime();if(a&&q&&i>o-q)return clearTimeout(r),r=setTimeout(u,i),void 0;q=o;for(var p in e)if(e.hasOwnProperty(p)){var v=e[p],w=v.minw,x=v.maxw,y=null===w,z=null===x,A="em";w&&(w=parseFloat(w)*(w.indexOf(A)>-1?t||s():1)),x&&(x=parseFloat(x)*(x.indexOf(A)>-1?t||s():1)),v.hasquery&&(y&&z||!(y||k>=w)||!(z||x>=k))||(m[v.media]||(m[v.media]=[]),m[v.media].push(f[v.rules]))}for(var B in g)g.hasOwnProperty(B)&&g[B]&&g[B].parentNode===j&&j.removeChild(g[B]);for(var C in m)if(m.hasOwnProperty(C)){var D=c.createElement("style"),E=m[C].join("\n");D.type="text/css",D.media=C,j.insertBefore(D,n.nextSibling),D.styleSheet?D.styleSheet.cssText=E:D.appendChild(c.createTextNode(E)),g.push(D)}},v=function(a,b){var c=w();c&&(c.open("GET",a,!0),c.onreadystatechange=function(){4!==c.readyState||200!==c.status&&304!==c.status||b(c.responseText)},4!==c.readyState&&c.send(null))},w=function(){var b=!1;try{b=new a.XMLHttpRequest}catch(c){b=new a.ActiveXObject("Microsoft.XMLHTTP")}return function(){return b}}();n(),b.update=n,a.addEventListener?a.addEventListener("resize",x,!1):a.attachEvent&&a.attachEvent("onresize",x)})(this);
|
||||
@@ -0,0 +1,50 @@
|
||||
$(function() {
|
||||
|
||||
var Page = (function() {
|
||||
|
||||
var $nav = $( '#nav-dots > span' ),
|
||||
slitslider = $( '#slider' ).slitslider( {
|
||||
onBeforeChange : function( slide, pos ) {
|
||||
|
||||
$nav.removeClass( 'nav-dot-current' );
|
||||
$nav.eq( pos ).addClass( 'nav-dot-current' );
|
||||
|
||||
}
|
||||
} ),
|
||||
|
||||
init = function() {
|
||||
|
||||
initEvents();
|
||||
|
||||
},
|
||||
initEvents = function() {
|
||||
|
||||
$nav.each( function( i ) {
|
||||
|
||||
$( this ).on( 'click', function( event ) {
|
||||
|
||||
var $dot = $( this );
|
||||
|
||||
if( !slitslider.isActive() ) {
|
||||
|
||||
$nav.removeClass( 'nav-dot-current' );
|
||||
$dot.addClass( 'nav-dot-current' );
|
||||
|
||||
}
|
||||
|
||||
slitslider.jump( i + 1 );
|
||||
return false;
|
||||
|
||||
} );
|
||||
|
||||
} );
|
||||
|
||||
};
|
||||
|
||||
return { init : init };
|
||||
|
||||
})();
|
||||
|
||||
Page.init();
|
||||
|
||||
});
|
||||
@@ -0,0 +1,303 @@
|
||||
// SmoothScroll v0.9.9
|
||||
// Licensed under the terms of the MIT license.
|
||||
// People involved
|
||||
// - Balazs Galambosi: maintainer (CHANGELOG.txt)
|
||||
// - Patrick Brunner (patrickb1991@gmail.com)
|
||||
// - Michael Herf: ssc_pulse Algorithm
|
||||
|
||||
function ssc_init() {
|
||||
if (!document.body) return;
|
||||
var e = document.body;
|
||||
var t = document.documentElement;
|
||||
var n = window.innerHeight;
|
||||
var r = e.scrollHeight;
|
||||
ssc_root = document.compatMode.indexOf("CSS") >= 0 ? t : e;
|
||||
ssc_activeElement = e;
|
||||
ssc_initdone = true;
|
||||
if (top != self) {
|
||||
ssc_frame = true
|
||||
} else if (r > n && (e.offsetHeight <= n || t.offsetHeight <= n)) {
|
||||
ssc_root.style.height = "auto";
|
||||
if (ssc_root.offsetHeight <= n) {
|
||||
var i = document.createElement("div");
|
||||
i.style.clear = "both";
|
||||
e.appendChild(i)
|
||||
}
|
||||
}
|
||||
if (!ssc_fixedback) {
|
||||
e.style.backgroundAttachment = "scroll";
|
||||
t.style.backgroundAttachment = "scroll"
|
||||
}
|
||||
if (ssc_keyboardsupport) {
|
||||
ssc_addEvent("keydown", ssc_keydown)
|
||||
}
|
||||
}
|
||||
|
||||
function ssc_scrollArray(e, t, n, r) {
|
||||
r || (r = 1e3);
|
||||
ssc_directionCheck(t, n);
|
||||
ssc_que.push({
|
||||
x: t,
|
||||
y: n,
|
||||
lastX: t < 0 ? .99 : -.99,
|
||||
lastY: n < 0 ? .99 : -.99,
|
||||
start: +(new Date)
|
||||
});
|
||||
if (ssc_pending) {
|
||||
return
|
||||
}
|
||||
var i = function() {
|
||||
var s = +(new Date);
|
||||
var o = 0;
|
||||
var u = 0;
|
||||
for (var a = 0; a < ssc_que.length; a++) {
|
||||
var f = ssc_que[a];
|
||||
var l = s - f.start;
|
||||
var c = l >= ssc_animtime;
|
||||
var h = c ? 1 : l / ssc_animtime;
|
||||
if (ssc_pulseAlgorithm) {
|
||||
h = ssc_pulse(h)
|
||||
}
|
||||
var p = f.x * h - f.lastX >> 0;
|
||||
var d = f.y * h - f.lastY >> 0;
|
||||
o += p;
|
||||
u += d;
|
||||
f.lastX += p;
|
||||
f.lastY += d;
|
||||
if (c) {
|
||||
ssc_que.splice(a, 1);
|
||||
a--
|
||||
}
|
||||
}
|
||||
if (t) {
|
||||
var v = e.scrollLeft;
|
||||
e.scrollLeft += o;
|
||||
if (o && e.scrollLeft === v) {
|
||||
t = 0
|
||||
}
|
||||
}
|
||||
if (n) {
|
||||
var m = e.scrollTop;
|
||||
e.scrollTop += u;
|
||||
if (u && e.scrollTop === m) {
|
||||
n = 0
|
||||
}
|
||||
}
|
||||
if (!t && !n) {
|
||||
ssc_que = []
|
||||
}
|
||||
if (ssc_que.length) {
|
||||
setTimeout(i, r / ssc_framerate + 1)
|
||||
} else {
|
||||
ssc_pending = false
|
||||
}
|
||||
};
|
||||
setTimeout(i, 0);
|
||||
ssc_pending = true
|
||||
}
|
||||
|
||||
function ssc_wheel(e) {
|
||||
if (!ssc_initdone) {
|
||||
ssc_init()
|
||||
}
|
||||
var t = e.target;
|
||||
var n = ssc_overflowingAncestor(t);
|
||||
if (!n || e.defaultPrevented || ssc_isNodeName(ssc_activeElement, "embed") || ssc_isNodeName(t, "embed") && /\.pdf/i.test(t.src)) {
|
||||
return true
|
||||
}
|
||||
var r = e.wheelDeltaX || 0;
|
||||
var i = e.wheelDeltaY || 0;
|
||||
if (!r && !i) {
|
||||
i = e.wheelDelta || 0
|
||||
}
|
||||
if (Math.abs(r) > 1.2) {
|
||||
r *= ssc_stepsize / 120
|
||||
}
|
||||
if (Math.abs(i) > 1.2) {
|
||||
i *= ssc_stepsize / 120
|
||||
}
|
||||
ssc_scrollArray(n, -r, -i);
|
||||
e.preventDefault()
|
||||
}
|
||||
|
||||
function ssc_keydown(e) {
|
||||
var t = e.target;
|
||||
var n = e.ctrlKey || e.altKey || e.metaKey;
|
||||
if (/input|textarea|embed/i.test(t.nodeName) || t.isContentEditable || e.defaultPrevented || n) {
|
||||
return true
|
||||
}
|
||||
if (ssc_isNodeName(t, "button") && e.keyCode === ssc_key.spacebar) {
|
||||
return true
|
||||
}
|
||||
var r, i = 0,
|
||||
s = 0;
|
||||
var o = ssc_overflowingAncestor(ssc_activeElement);
|
||||
var u = o.clientHeight;
|
||||
if (o == document.body) {
|
||||
u = window.innerHeight
|
||||
}
|
||||
switch (e.keyCode) {
|
||||
case ssc_key.up:
|
||||
s = -ssc_arrowscroll;
|
||||
break;
|
||||
case ssc_key.down:
|
||||
s = ssc_arrowscroll;
|
||||
break;
|
||||
case ssc_key.spacebar:
|
||||
r = e.shiftKey ? 1 : -1;
|
||||
s = -r * u * .9;
|
||||
break;
|
||||
case ssc_key.pageup:
|
||||
s = -u * .9;
|
||||
break;
|
||||
case ssc_key.pagedown:
|
||||
s = u * .9;
|
||||
break;
|
||||
case ssc_key.home:
|
||||
s = -o.scrollTop;
|
||||
break;
|
||||
case ssc_key.end:
|
||||
var a = o.scrollHeight - o.scrollTop - u;
|
||||
s = a > 0 ? a + 10 : 0;
|
||||
break;
|
||||
case ssc_key.left:
|
||||
i = -ssc_arrowscroll;
|
||||
break;
|
||||
case ssc_key.right:
|
||||
i = ssc_arrowscroll;
|
||||
break;
|
||||
default:
|
||||
return true
|
||||
}
|
||||
ssc_scrollArray(o, i, s);
|
||||
e.preventDefault()
|
||||
}
|
||||
|
||||
function ssc_mousedown(e) {
|
||||
ssc_activeElement = e.target
|
||||
}
|
||||
|
||||
function ssc_setCache(e, t) {
|
||||
for (var n = e.length; n--;) ssc_cache[ssc_uniqueID(e[n])] = t;
|
||||
return t
|
||||
}
|
||||
|
||||
function ssc_overflowingAncestor(e) {
|
||||
var t = [];
|
||||
var n = ssc_root.scrollHeight;
|
||||
do {
|
||||
var r = ssc_cache[ssc_uniqueID(e)];
|
||||
if (r) {
|
||||
return ssc_setCache(t, r)
|
||||
}
|
||||
t.push(e);
|
||||
if (n === e.scrollHeight) {
|
||||
if (!ssc_frame || ssc_root.clientHeight + 10 < n) {
|
||||
return ssc_setCache(t, document.body)
|
||||
}
|
||||
} else if (e.clientHeight + 10 < e.scrollHeight) {
|
||||
overflow = getComputedStyle(e, "").getPropertyValue("overflow");
|
||||
if (overflow === "scroll" || overflow === "auto") {
|
||||
return ssc_setCache(t, e)
|
||||
}
|
||||
}
|
||||
} while (e = e.parentNode)
|
||||
}
|
||||
|
||||
function ssc_addEvent(e, t, n) {
|
||||
window.addEventListener(e, t, n || false)
|
||||
}
|
||||
|
||||
function ssc_removeEvent(e, t, n) {
|
||||
window.removeEventListener(e, t, n || false)
|
||||
}
|
||||
|
||||
function ssc_isNodeName(e, t) {
|
||||
return e.nodeName.toLowerCase() === t.toLowerCase()
|
||||
}
|
||||
|
||||
function ssc_directionCheck(e, t) {
|
||||
e = e > 0 ? 1 : -1;
|
||||
t = t > 0 ? 1 : -1;
|
||||
if (ssc_direction.x !== e || ssc_direction.y !== t) {
|
||||
ssc_direction.x = e;
|
||||
ssc_direction.y = t;
|
||||
ssc_que = []
|
||||
}
|
||||
}
|
||||
|
||||
function ssc_pulse_(e) {
|
||||
var t, n, r;
|
||||
e = e * ssc_pulseScale;
|
||||
if (e < 1) {
|
||||
t = e - (1 - Math.exp(-e))
|
||||
} else {
|
||||
n = Math.exp(-1);
|
||||
e -= 1;
|
||||
r = 1 - Math.exp(-e);
|
||||
t = n + r * (1 - n)
|
||||
}
|
||||
return t * ssc_pulseNormalize
|
||||
}
|
||||
|
||||
function ssc_pulse(e) {
|
||||
if (e >= 1) return 1;
|
||||
if (e <= 0) return 0;
|
||||
if (ssc_pulseNormalize == 1) {
|
||||
ssc_pulseNormalize /= ssc_pulse_(1)
|
||||
}
|
||||
return ssc_pulse_(e)
|
||||
}
|
||||
|
||||
var ssc_framerate = 150;
|
||||
var ssc_animtime = 500;
|
||||
var ssc_stepsize = 150;
|
||||
var ssc_pulseAlgorithm = true;
|
||||
var ssc_pulseScale = 6;
|
||||
var ssc_pulseNormalize = 1;
|
||||
var ssc_keyboardsupport = true;
|
||||
var ssc_arrowscroll = 50;
|
||||
var ssc_frame = false;
|
||||
var ssc_direction = {
|
||||
x: 0,
|
||||
y: 0
|
||||
};
|
||||
|
||||
var ssc_initdone = false;
|
||||
var ssc_fixedback = true;
|
||||
var ssc_root = document.documentElement;
|
||||
var ssc_activeElement;
|
||||
var ssc_key = {
|
||||
left: 37,
|
||||
up: 38,
|
||||
right: 39,
|
||||
down: 40,
|
||||
spacebar: 32,
|
||||
pageup: 33,
|
||||
pagedown: 34,
|
||||
end: 35,
|
||||
home: 36
|
||||
};
|
||||
|
||||
var ssc_que = [];
|
||||
var ssc_pending = false;
|
||||
var ssc_cache = {};
|
||||
|
||||
setInterval(function() {
|
||||
ssc_cache = {}
|
||||
}, 10 * 1e3);
|
||||
|
||||
var ssc_uniqueID = function() {
|
||||
var e = 0;
|
||||
return function(t) {
|
||||
return t.ssc_uniqueID || (t.ssc_uniqueID = e++)
|
||||
}
|
||||
}();
|
||||
|
||||
var ischrome = /chrome/.test(navigator.userAgent.toLowerCase());
|
||||
|
||||
if (ischrome) {
|
||||
ssc_addEvent("mousedown", ssc_mousedown);
|
||||
ssc_addEvent("mousewheel", ssc_wheel);
|
||||
ssc_addEvent("load", ssc_init)
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
/*! WOW - v0.1.9 - 2014-05-10
|
||||
* Copyright (c) 2014 Matthieu Aussaguel; Licensed MIT */(function(){var a,b,c=function(a,b){return function(){return a.apply(b,arguments)}};a=function(){function a(){}return a.prototype.extend=function(a,b){var c,d;for(c in a)d=a[c],null!=d&&(b[c]=d);return b},a.prototype.isMobile=function(a){return/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(a)},a}(),b=this.WeakMap||(b=function(){function a(){this.keys=[],this.values=[]}return a.prototype.get=function(a){var b,c,d,e,f;for(f=this.keys,b=d=0,e=f.length;e>d;b=++d)if(c=f[b],c===a)return this.values[b]},a.prototype.set=function(a,b){var c,d,e,f,g;for(g=this.keys,c=e=0,f=g.length;f>e;c=++e)if(d=g[c],d===a)return void(this.values[c]=b);return this.keys.push(a),this.values.push(b)},a}()),this.WOW=function(){function d(a){null==a&&(a={}),this.scrollCallback=c(this.scrollCallback,this),this.scrollHandler=c(this.scrollHandler,this),this.start=c(this.start,this),this.scrolled=!0,this.config=this.util().extend(a,this.defaults),this.animationNameCache=new b}return d.prototype.defaults={boxClass:"wow",animateClass:"animated",offset:0,mobile:!0},d.prototype.init=function(){var a;return this.element=window.document.documentElement,"interactive"===(a=document.readyState)||"complete"===a?this.start():document.addEventListener("DOMContentLoaded",this.start)},d.prototype.start=function(){var a,b,c,d;if(this.boxes=this.element.getElementsByClassName(this.config.boxClass),this.boxes.length){if(this.disabled())return this.resetStyle();for(d=this.boxes,b=0,c=d.length;c>b;b++)a=d[b],this.applyStyle(a,!0);return window.addEventListener("scroll",this.scrollHandler,!1),window.addEventListener("resize",this.scrollHandler,!1),this.interval=setInterval(this.scrollCallback,50)}},d.prototype.stop=function(){return window.removeEventListener("scroll",this.scrollHandler,!1),window.removeEventListener("resize",this.scrollHandler,!1),null!=this.interval?clearInterval(this.interval):void 0},d.prototype.show=function(a){return this.applyStyle(a),a.className=""+a.className+" "+this.config.animateClass},d.prototype.applyStyle=function(a,b){var c,d,e;return d=a.getAttribute("data-wow-duration"),c=a.getAttribute("data-wow-delay"),e=a.getAttribute("data-wow-iteration"),this.animate(function(f){return function(){return f.customStyle(a,b,d,c,e)}}(this))},d.prototype.animate=function(){return"requestAnimationFrame"in window?function(a){return window.requestAnimationFrame(a)}:function(a){return a()}}(),d.prototype.resetStyle=function(){var a,b,c,d,e;for(d=this.boxes,e=[],b=0,c=d.length;c>b;b++)a=d[b],e.push(a.setAttribute("style","visibility: visible;"));return e},d.prototype.customStyle=function(a,b,c,d,e){return b&&this.cacheAnimationName(a),a.style.visibility=b?"hidden":"visible",c&&this.vendorSet(a.style,{animationDuration:c}),d&&this.vendorSet(a.style,{animationDelay:d}),e&&this.vendorSet(a.style,{animationIterationCount:e}),this.vendorSet(a.style,{animationName:b?"none":this.cachedAnimationName(a)}),a},d.prototype.vendors=["moz","webkit"],d.prototype.vendorSet=function(a,b){var c,d,e,f;f=[];for(c in b)d=b[c],a[""+c]=d,f.push(function(){var b,f,g,h;for(g=this.vendors,h=[],b=0,f=g.length;f>b;b++)e=g[b],h.push(a[""+e+c.charAt(0).toUpperCase()+c.substr(1)]=d);return h}.call(this));return f},d.prototype.vendorCSS=function(a,b){var c,d,e,f,g,h;for(d=window.getComputedStyle(a),c=d.getPropertyCSSValue(b),h=this.vendors,f=0,g=h.length;g>f;f++)e=h[f],c=c||d.getPropertyCSSValue("-"+e+"-"+b);return c},d.prototype.animationName=function(a){var b;try{b=this.vendorCSS(a,"animation-name").cssText}catch(c){b=window.getComputedStyle(a).getPropertyValue("animation-name")}return"none"===b?"":b},d.prototype.cacheAnimationName=function(a){return this.animationNameCache.set(a,this.animationName(a))},d.prototype.cachedAnimationName=function(a){return this.animationNameCache.get(a)},d.prototype.scrollHandler=function(){return this.scrolled=!0},d.prototype.scrollCallback=function(){var a;return this.scrolled&&(this.scrolled=!1,this.boxes=function(){var b,c,d,e;for(d=this.boxes,e=[],b=0,c=d.length;c>b;b++)a=d[b],a&&(this.isVisible(a)?this.show(a):e.push(a));return e}.call(this),!this.boxes.length)?this.stop():void 0},d.prototype.offsetTop=function(a){for(var b;void 0===a.offsetTop;)a=a.parentNode;for(b=a.offsetTop;a=a.offsetParent;)b+=a.offsetTop;return b},d.prototype.isVisible=function(a){var b,c,d,e,f;return c=a.getAttribute("data-wow-offset")||this.config.offset,f=window.pageYOffset,e=f+this.element.clientHeight-c,d=this.offsetTop(a),b=d+a.clientHeight,e>=d&&b>=f},d.prototype.util=function(){return this._util||(this._util=new a)},d.prototype.disabled=function(){return!this.config.mobile&&this.util().isMobile(navigator.userAgent)},d}()}).call(this);
|
||||
Reference in New Issue
Block a user