5649 lines
184 KiB
JavaScript
5649 lines
184 KiB
JavaScript
// JavaScript Document
|
|
/*
|
|
* jQuery Easing v1.3 - http://gsgd.co.uk/sandbox/jquery/easing/
|
|
*
|
|
* Uses the built in easing capabilities added In jQuery 1.1
|
|
* to offer multiple easing options
|
|
*
|
|
* TERMS OF USE - jQuery Easing
|
|
*
|
|
* Open source under the BSD License.
|
|
*
|
|
* Copyright © 2008 George McGinley Smith
|
|
* All rights reserved.
|
|
*
|
|
* Redistribution and use in source and binary forms, with or without modification,
|
|
* are permitted provided that the following conditions are met:
|
|
*
|
|
* Redistributions of source code must retain the above copyright notice, this list of
|
|
* conditions and the following disclaimer.
|
|
* Redistributions in binary form must reproduce the above copyright notice, this list
|
|
* of conditions and the following disclaimer in the documentation and/or other materials
|
|
* provided with the distribution.
|
|
*
|
|
* Neither the name of the author nor the names of contributors may be used to endorse
|
|
* or promote products derived from this software without specific prior written permission.
|
|
*
|
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
|
|
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
|
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
|
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
|
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
|
|
* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
|
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
|
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
|
|
* OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
*
|
|
*/
|
|
|
|
// t: current time, b: begInnIng value, c: change In value, d: duration
|
|
jQuery.easing['jswing'] = jQuery.easing['swing'];
|
|
|
|
jQuery.extend( jQuery.easing,
|
|
{
|
|
def: 'easeOutQuad',
|
|
swing: function (x, t, b, c, d) {
|
|
//alert(jQuery.easing.default);
|
|
return jQuery.easing[jQuery.easing.def](x, t, b, c, d);
|
|
},
|
|
easeInQuad: function (x, t, b, c, d) {
|
|
return c*(t/=d)*t + b;
|
|
},
|
|
easeOutQuad: function (x, t, b, c, d) {
|
|
return -c *(t/=d)*(t-2) + b;
|
|
},
|
|
easeInOutQuad: function (x, t, b, c, d) {
|
|
if ((t/=d/2) < 1) return c/2*t*t + b;
|
|
return -c/2 * ((--t)*(t-2) - 1) + b;
|
|
},
|
|
easeInCubic: function (x, t, b, c, d) {
|
|
return c*(t/=d)*t*t + b;
|
|
},
|
|
easeOutCubic: function (x, t, b, c, d) {
|
|
return c*((t=t/d-1)*t*t + 1) + b;
|
|
},
|
|
easeInOutCubic: function (x, t, b, c, d) {
|
|
if ((t/=d/2) < 1) return c/2*t*t*t + b;
|
|
return c/2*((t-=2)*t*t + 2) + b;
|
|
},
|
|
easeInQuart: function (x, t, b, c, d) {
|
|
return c*(t/=d)*t*t*t + b;
|
|
},
|
|
easeOutQuart: function (x, t, b, c, d) {
|
|
return -c * ((t=t/d-1)*t*t*t - 1) + b;
|
|
},
|
|
easeInOutQuart: function (x, t, b, c, d) {
|
|
if ((t/=d/2) < 1) return c/2*t*t*t*t + b;
|
|
return -c/2 * ((t-=2)*t*t*t - 2) + b;
|
|
},
|
|
easeInQuint: function (x, t, b, c, d) {
|
|
return c*(t/=d)*t*t*t*t + b;
|
|
},
|
|
easeOutQuint: function (x, t, b, c, d) {
|
|
return c*((t=t/d-1)*t*t*t*t + 1) + b;
|
|
},
|
|
easeInOutQuint: function (x, t, b, c, d) {
|
|
if ((t/=d/2) < 1) return c/2*t*t*t*t*t + b;
|
|
return c/2*((t-=2)*t*t*t*t + 2) + b;
|
|
},
|
|
easeInSine: function (x, t, b, c, d) {
|
|
return -c * Math.cos(t/d * (Math.PI/2)) + c + b;
|
|
},
|
|
easeOutSine: function (x, t, b, c, d) {
|
|
return c * Math.sin(t/d * (Math.PI/2)) + b;
|
|
},
|
|
easeInOutSine: function (x, t, b, c, d) {
|
|
return -c/2 * (Math.cos(Math.PI*t/d) - 1) + b;
|
|
},
|
|
easeInExpo: function (x, t, b, c, d) {
|
|
return (t==0) ? b : c * Math.pow(2, 10 * (t/d - 1)) + b;
|
|
},
|
|
easeOutExpo: function (x, t, b, c, d) {
|
|
return (t==d) ? b+c : c * (-Math.pow(2, -10 * t/d) + 1) + b;
|
|
},
|
|
easeInOutExpo: function (x, t, b, c, d) {
|
|
if (t==0) return b;
|
|
if (t==d) return b+c;
|
|
if ((t/=d/2) < 1) return c/2 * Math.pow(2, 10 * (t - 1)) + b;
|
|
return c/2 * (-Math.pow(2, -10 * --t) + 2) + b;
|
|
},
|
|
easeInCirc: function (x, t, b, c, d) {
|
|
return -c * (Math.sqrt(1 - (t/=d)*t) - 1) + b;
|
|
},
|
|
easeOutCirc: function (x, t, b, c, d) {
|
|
return c * Math.sqrt(1 - (t=t/d-1)*t) + b;
|
|
},
|
|
easeInOutCirc: function (x, t, b, c, d) {
|
|
if ((t/=d/2) < 1) return -c/2 * (Math.sqrt(1 - t*t) - 1) + b;
|
|
return c/2 * (Math.sqrt(1 - (t-=2)*t) + 1) + b;
|
|
},
|
|
easeInElastic: function (x, t, b, c, d) {
|
|
var s=1.70158;var p=0;var a=c;
|
|
if (t==0) return b; if ((t/=d)==1) return b+c; if (!p) p=d*.3;
|
|
if (a < Math.abs(c)) { a=c; var s=p/4; }
|
|
else var s = p/(2*Math.PI) * Math.asin (c/a);
|
|
return -(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b;
|
|
},
|
|
easeOutElastic: function (x, t, b, c, d) {
|
|
var s=1.70158;var p=0;var a=c;
|
|
if (t==0) return b; if ((t/=d)==1) return b+c; if (!p) p=d*.3;
|
|
if (a < Math.abs(c)) { a=c; var s=p/4; }
|
|
else var s = p/(2*Math.PI) * Math.asin (c/a);
|
|
return a*Math.pow(2,-10*t) * Math.sin( (t*d-s)*(2*Math.PI)/p ) + c + b;
|
|
},
|
|
easeInOutElastic: function (x, t, b, c, d) {
|
|
var s=1.70158;var p=0;var a=c;
|
|
if (t==0) return b; if ((t/=d/2)==2) return b+c; if (!p) p=d*(.3*1.5);
|
|
if (a < Math.abs(c)) { a=c; var s=p/4; }
|
|
else var s = p/(2*Math.PI) * Math.asin (c/a);
|
|
if (t < 1) return -.5*(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b;
|
|
return a*Math.pow(2,-10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )*.5 + c + b;
|
|
},
|
|
easeInBack: function (x, t, b, c, d, s) {
|
|
if (s == undefined) s = 1.70158;
|
|
return c*(t/=d)*t*((s+1)*t - s) + b;
|
|
},
|
|
easeOutBack: function (x, t, b, c, d, s) {
|
|
if (s == undefined) s = 1.70158;
|
|
return c*((t=t/d-1)*t*((s+1)*t + s) + 1) + b;
|
|
},
|
|
easeInOutBack: function (x, t, b, c, d, s) {
|
|
if (s == undefined) s = 1.70158;
|
|
if ((t/=d/2) < 1) return c/2*(t*t*(((s*=(1.525))+1)*t - s)) + b;
|
|
return c/2*((t-=2)*t*(((s*=(1.525))+1)*t + s) + 2) + b;
|
|
},
|
|
easeInBounce: function (x, t, b, c, d) {
|
|
return c - jQuery.easing.easeOutBounce (x, d-t, 0, c, d) + b;
|
|
},
|
|
easeOutBounce: function (x, t, b, c, d) {
|
|
if ((t/=d) < (1/2.75)) {
|
|
return c*(7.5625*t*t) + b;
|
|
} else if (t < (2/2.75)) {
|
|
return c*(7.5625*(t-=(1.5/2.75))*t + .75) + b;
|
|
} else if (t < (2.5/2.75)) {
|
|
return c*(7.5625*(t-=(2.25/2.75))*t + .9375) + b;
|
|
} else {
|
|
return c*(7.5625*(t-=(2.625/2.75))*t + .984375) + b;
|
|
}
|
|
},
|
|
easeInOutBounce: function (x, t, b, c, d) {
|
|
if (t < d/2) return jQuery.easing.easeInBounce (x, t*2, 0, c, d) * .5 + b;
|
|
return jQuery.easing.easeOutBounce (x, t*2-d, 0, c, d) * .5 + c*.5 + b;
|
|
}
|
|
});
|
|
|
|
/*
|
|
*
|
|
* TERMS OF USE - EASING EQUATIONS
|
|
*
|
|
* Open source under the BSD License.
|
|
*
|
|
* Copyright © 2001 Robert Penner
|
|
* All rights reserved.
|
|
*
|
|
* Redistribution and use in source and binary forms, with or without modification,
|
|
* are permitted provided that the following conditions are met:
|
|
*
|
|
* Redistributions of source code must retain the above copyright notice, this list of
|
|
* conditions and the following disclaimer.
|
|
* Redistributions in binary form must reproduce the above copyright notice, this list
|
|
* of conditions and the following disclaimer in the documentation and/or other materials
|
|
* provided with the distribution.
|
|
*
|
|
* Neither the name of the author nor the names of contributors may be used to endorse
|
|
* or promote products derived from this software without specific prior written permission.
|
|
*
|
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
|
|
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
|
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
|
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
|
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
|
|
* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
|
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
|
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
|
|
* OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
*
|
|
*/
|
|
/**********************************************************************************************************/
|
|
|
|
// jquery.events.frame.js
|
|
// 1.1 - lite
|
|
// Stephen Band
|
|
//
|
|
// Project home:
|
|
// webdev.stephband.info/events/frame/
|
|
//
|
|
// Source:
|
|
// http://github.com/stephband/jquery.event.frame
|
|
|
|
(function(jQuery, undefined){
|
|
|
|
var timer;
|
|
|
|
// Timer constructor
|
|
// fn - callback to call on each frame, with context set to the timer object
|
|
// fd - frame duration in milliseconds
|
|
|
|
function Timer( fn, fd ) {
|
|
var self = this,
|
|
clock;
|
|
|
|
function update(){
|
|
self.frameCount++;
|
|
fn.call(self);
|
|
}
|
|
|
|
this.frameDuration = fd || 25 ;
|
|
this.frameCount = -1 ;
|
|
this.start = function(){
|
|
update();
|
|
clock = setInterval(update, this.frameDuration);
|
|
};
|
|
this.stop = function(){
|
|
clearInterval( clock );
|
|
clock = null;
|
|
};
|
|
}
|
|
|
|
// callHandler() is the callback given to the timer object,
|
|
// it makes the event object and calls the handler
|
|
// context is the timer object
|
|
|
|
function callHandler(){
|
|
var fn = jQuery.event.special.frame.handler,
|
|
event = jQuery.Event("frame"),
|
|
array = this.array,
|
|
l = array.length;
|
|
|
|
// Give event object properties
|
|
event.frameCount = this.frameCount;
|
|
|
|
// Call handler on each elem in array
|
|
while (l--) {
|
|
fn.call(array[l], event);
|
|
}
|
|
}
|
|
|
|
if (!jQuery.event.special.frame) {
|
|
jQuery.event.special.frame = {
|
|
// Fires the first time an event is bound per element
|
|
setup: function(data, namespaces) {
|
|
if ( timer ) {
|
|
timer.array.push(this);
|
|
}
|
|
else {
|
|
timer = new Timer( callHandler, data && data.frameDuration );
|
|
timer.array = [this];
|
|
|
|
// Queue timer to start as soon as this thread has finished
|
|
var t = setTimeout(function(){
|
|
timer.start();
|
|
clearTimeout(t);
|
|
t = null;
|
|
}, 0);
|
|
}
|
|
return;
|
|
},
|
|
// Fires last time event is unbound per element
|
|
teardown: function(namespaces) {
|
|
var array = timer.array,
|
|
l = array.length;
|
|
|
|
// Remove element from list
|
|
while (l--) {
|
|
if (array[l] === this) {
|
|
array.splice(l, 1);
|
|
break;
|
|
}
|
|
}
|
|
|
|
// Stop and remove timer when no elems left
|
|
if (array.length === 0) {
|
|
timer.stop();
|
|
timer = undefined;
|
|
}
|
|
return;
|
|
},
|
|
handler: function(event){
|
|
// let jQuery handle the calling of event handlers
|
|
jQuery.event.handle.apply(this, arguments);
|
|
}
|
|
};
|
|
}
|
|
|
|
})(jQuery);
|
|
/********************************************************************************************************/
|
|
|
|
/*
|
|
* jQuery Mobile Framework v1.2.0
|
|
* http://jquerymobile.com
|
|
*
|
|
* Copyright 2012 jQuery Foundation and other contributors
|
|
* Released under the MIT license.
|
|
* http://jquery.org/license
|
|
*
|
|
*/
|
|
|
|
(function ( root, doc, factory ) {
|
|
if ( typeof define === "function" && define.amd ) {
|
|
// AMD. Register as an anonymous module.
|
|
define( [ "jquery" ], function ( $ ) {
|
|
factory( $, root, doc );
|
|
return $.mobile;
|
|
});
|
|
} else {
|
|
// Browser globals
|
|
factory( root.jQuery, root, doc );
|
|
}
|
|
}( this, document, function ( jQuery, window, document, undefined ) {
|
|
(function( $, undefined ) {
|
|
var support = {
|
|
touch: "ontouchend" in document
|
|
};
|
|
|
|
$.mobile = $.mobile || {};
|
|
$.mobile.support = $.mobile.support || {};
|
|
$.extend( $.support, support );
|
|
$.extend( $.mobile.support, support );
|
|
}( jQuery ));
|
|
|
|
|
|
// This plugin is an experiment for abstracting away the touch and mouse
|
|
// events so that developers don't have to worry about which method of input
|
|
// the device their document is loaded on supports.
|
|
//
|
|
// The idea here is to allow the developer to register listeners for the
|
|
// basic mouse events, such as mousedown, mousemove, mouseup, and click,
|
|
// and the plugin will take care of registering the correct listeners
|
|
// behind the scenes to invoke the listener at the fastest possible time
|
|
// for that device, while still retaining the order of event firing in
|
|
// the traditional mouse environment, should multiple handlers be registered
|
|
// on the same element for different events.
|
|
//
|
|
// The current version exposes the following virtual events to jQuery bind methods:
|
|
// "vmouseover vmousedown vmousemove vmouseup vclick vmouseout vmousecancel"
|
|
|
|
(function( $, window, document, undefined ) {
|
|
|
|
var dataPropertyName = "virtualMouseBindings",
|
|
touchTargetPropertyName = "virtualTouchID",
|
|
virtualEventNames = "vmouseover vmousedown vmousemove vmouseup vclick vmouseout vmousecancel".split( " " ),
|
|
touchEventProps = "clientX clientY pageX pageY screenX screenY".split( " " ),
|
|
mouseHookProps = $.event.mouseHooks ? $.event.mouseHooks.props : [],
|
|
mouseEventProps = $.event.props.concat( mouseHookProps ),
|
|
activeDocHandlers = {},
|
|
resetTimerID = 0,
|
|
startX = 0,
|
|
startY = 0,
|
|
didScroll = false,
|
|
clickBlockList = [],
|
|
blockMouseTriggers = false,
|
|
blockTouchTriggers = false,
|
|
eventCaptureSupported = "addEventListener" in document,
|
|
$document = $( document ),
|
|
nextTouchID = 1,
|
|
lastTouchID = 0, threshold;
|
|
|
|
$.vmouse = {
|
|
moveDistanceThreshold: 10,
|
|
clickDistanceThreshold: 10,
|
|
resetTimerDuration: 1500
|
|
};
|
|
|
|
function getNativeEvent( event ) {
|
|
|
|
while ( event && typeof event.originalEvent !== "undefined" ) {
|
|
event = event.originalEvent;
|
|
}
|
|
return event;
|
|
}
|
|
|
|
function createVirtualEvent( event, eventType ) {
|
|
|
|
var t = event.type,
|
|
oe, props, ne, prop, ct, touch, i, j, len;
|
|
|
|
event = $.Event( event );
|
|
event.type = eventType;
|
|
|
|
oe = event.originalEvent;
|
|
props = $.event.props;
|
|
|
|
// addresses separation of $.event.props in to $.event.mouseHook.props and Issue 3280
|
|
// https://github.com/jquery/jquery-mobile/issues/3280
|
|
if ( t.search( /^(mouse|click)/ ) > -1 ) {
|
|
props = mouseEventProps;
|
|
}
|
|
|
|
// copy original event properties over to the new event
|
|
// this would happen if we could call $.event.fix instead of $.Event
|
|
// but we don't have a way to force an event to be fixed multiple times
|
|
if ( oe ) {
|
|
for ( i = props.length, prop; i; ) {
|
|
prop = props[ --i ];
|
|
event[ prop ] = oe[ prop ];
|
|
}
|
|
}
|
|
|
|
// make sure that if the mouse and click virtual events are generated
|
|
// without a .which one is defined
|
|
if ( t.search(/mouse(down|up)|click/) > -1 && !event.which ) {
|
|
event.which = 1;
|
|
}
|
|
|
|
if ( t.search(/^touch/) !== -1 ) {
|
|
ne = getNativeEvent( oe );
|
|
t = ne.touches;
|
|
ct = ne.changedTouches;
|
|
touch = ( t && t.length ) ? t[0] : ( ( ct && ct.length ) ? ct[ 0 ] : undefined );
|
|
|
|
if ( touch ) {
|
|
for ( j = 0, len = touchEventProps.length; j < len; j++) {
|
|
prop = touchEventProps[ j ];
|
|
event[ prop ] = touch[ prop ];
|
|
}
|
|
}
|
|
}
|
|
|
|
return event;
|
|
}
|
|
|
|
function getVirtualBindingFlags( element ) {
|
|
|
|
var flags = {},
|
|
b, k;
|
|
|
|
while ( element ) {
|
|
|
|
b = $.data( element, dataPropertyName );
|
|
|
|
for ( k in b ) {
|
|
if ( b[ k ] ) {
|
|
flags[ k ] = flags.hasVirtualBinding = true;
|
|
}
|
|
}
|
|
element = element.parentNode;
|
|
}
|
|
return flags;
|
|
}
|
|
|
|
function getClosestElementWithVirtualBinding( element, eventType ) {
|
|
var b;
|
|
while ( element ) {
|
|
|
|
b = $.data( element, dataPropertyName );
|
|
|
|
if ( b && ( !eventType || b[ eventType ] ) ) {
|
|
return element;
|
|
}
|
|
element = element.parentNode;
|
|
}
|
|
return null;
|
|
}
|
|
|
|
function enableTouchBindings() {
|
|
blockTouchTriggers = false;
|
|
}
|
|
|
|
function disableTouchBindings() {
|
|
blockTouchTriggers = true;
|
|
}
|
|
|
|
function enableMouseBindings() {
|
|
lastTouchID = 0;
|
|
clickBlockList.length = 0;
|
|
blockMouseTriggers = false;
|
|
|
|
// When mouse bindings are enabled, our
|
|
// touch bindings are disabled.
|
|
disableTouchBindings();
|
|
}
|
|
|
|
function disableMouseBindings() {
|
|
// When mouse bindings are disabled, our
|
|
// touch bindings are enabled.
|
|
enableTouchBindings();
|
|
}
|
|
|
|
function startResetTimer() {
|
|
clearResetTimer();
|
|
resetTimerID = setTimeout( function() {
|
|
resetTimerID = 0;
|
|
enableMouseBindings();
|
|
}, $.vmouse.resetTimerDuration );
|
|
}
|
|
|
|
function clearResetTimer() {
|
|
if ( resetTimerID ) {
|
|
clearTimeout( resetTimerID );
|
|
resetTimerID = 0;
|
|
}
|
|
}
|
|
|
|
function triggerVirtualEvent( eventType, event, flags ) {
|
|
var ve;
|
|
|
|
if ( ( flags && flags[ eventType ] ) ||
|
|
( !flags && getClosestElementWithVirtualBinding( event.target, eventType ) ) ) {
|
|
|
|
ve = createVirtualEvent( event, eventType );
|
|
|
|
$( event.target).trigger( ve );
|
|
}
|
|
|
|
return ve;
|
|
}
|
|
|
|
function mouseEventCallback( event ) {
|
|
var touchID = $.data( event.target, touchTargetPropertyName );
|
|
|
|
if ( !blockMouseTriggers && ( !lastTouchID || lastTouchID !== touchID ) ) {
|
|
var ve = triggerVirtualEvent( "v" + event.type, event );
|
|
if ( ve ) {
|
|
if ( ve.isDefaultPrevented() ) {
|
|
event.preventDefault();
|
|
}
|
|
if ( ve.isPropagationStopped() ) {
|
|
event.stopPropagation();
|
|
}
|
|
if ( ve.isImmediatePropagationStopped() ) {
|
|
event.stopImmediatePropagation();
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
function handleTouchStart( event ) {
|
|
|
|
var touches = getNativeEvent( event ).touches,
|
|
target, flags;
|
|
|
|
if ( touches && touches.length === 1 ) {
|
|
|
|
target = event.target;
|
|
flags = getVirtualBindingFlags( target );
|
|
|
|
if ( flags.hasVirtualBinding ) {
|
|
|
|
lastTouchID = nextTouchID++;
|
|
$.data( target, touchTargetPropertyName, lastTouchID );
|
|
|
|
clearResetTimer();
|
|
|
|
disableMouseBindings();
|
|
didScroll = false;
|
|
|
|
var t = getNativeEvent( event ).touches[ 0 ];
|
|
startX = t.pageX;
|
|
startY = t.pageY;
|
|
|
|
triggerVirtualEvent( "vmouseover", event, flags );
|
|
triggerVirtualEvent( "vmousedown", event, flags );
|
|
}
|
|
}
|
|
}
|
|
|
|
function handleScroll( event ) {
|
|
if ( blockTouchTriggers ) {
|
|
return;
|
|
}
|
|
|
|
if ( !didScroll ) {
|
|
triggerVirtualEvent( "vmousecancel", event, getVirtualBindingFlags( event.target ) );
|
|
}
|
|
|
|
didScroll = true;
|
|
startResetTimer();
|
|
}
|
|
|
|
function handleTouchMove( event ) {
|
|
if ( blockTouchTriggers ) {
|
|
return;
|
|
}
|
|
|
|
var t = getNativeEvent( event ).touches[ 0 ],
|
|
didCancel = didScroll,
|
|
moveThreshold = $.vmouse.moveDistanceThreshold,
|
|
flags = getVirtualBindingFlags( event.target );
|
|
|
|
didScroll = didScroll ||
|
|
( Math.abs( t.pageX - startX ) > moveThreshold ||
|
|
Math.abs( t.pageY - startY ) > moveThreshold );
|
|
|
|
|
|
if ( didScroll && !didCancel ) {
|
|
triggerVirtualEvent( "vmousecancel", event, flags );
|
|
}
|
|
|
|
triggerVirtualEvent( "vmousemove", event, flags );
|
|
startResetTimer();
|
|
}
|
|
|
|
function handleTouchEnd( event ) {
|
|
if ( blockTouchTriggers ) {
|
|
return;
|
|
}
|
|
|
|
disableTouchBindings();
|
|
|
|
var flags = getVirtualBindingFlags( event.target ),
|
|
t;
|
|
triggerVirtualEvent( "vmouseup", event, flags );
|
|
|
|
if ( !didScroll ) {
|
|
var ve = triggerVirtualEvent( "vclick", event, flags );
|
|
if ( ve && ve.isDefaultPrevented() ) {
|
|
// The target of the mouse events that follow the touchend
|
|
// event don't necessarily match the target used during the
|
|
// touch. This means we need to rely on coordinates for blocking
|
|
// any click that is generated.
|
|
t = getNativeEvent( event ).changedTouches[ 0 ];
|
|
clickBlockList.push({
|
|
touchID: lastTouchID,
|
|
x: t.clientX,
|
|
y: t.clientY
|
|
});
|
|
|
|
// Prevent any mouse events that follow from triggering
|
|
// virtual event notifications.
|
|
blockMouseTriggers = true;
|
|
}
|
|
}
|
|
triggerVirtualEvent( "vmouseout", event, flags);
|
|
didScroll = false;
|
|
|
|
startResetTimer();
|
|
}
|
|
|
|
function hasVirtualBindings( ele ) {
|
|
var bindings = $.data( ele, dataPropertyName ),
|
|
k;
|
|
|
|
if ( bindings ) {
|
|
for ( k in bindings ) {
|
|
if ( bindings[ k ] ) {
|
|
return true;
|
|
}
|
|
}
|
|
}
|
|
return false;
|
|
}
|
|
|
|
function dummyMouseHandler() {}
|
|
|
|
function getSpecialEventObject( eventType ) {
|
|
var realType = eventType.substr( 1 );
|
|
|
|
return {
|
|
setup: function( data, namespace ) {
|
|
// If this is the first virtual mouse binding for this element,
|
|
// add a bindings object to its data.
|
|
|
|
if ( !hasVirtualBindings( this ) ) {
|
|
$.data( this, dataPropertyName, {} );
|
|
}
|
|
|
|
// If setup is called, we know it is the first binding for this
|
|
// eventType, so initialize the count for the eventType to zero.
|
|
var bindings = $.data( this, dataPropertyName );
|
|
bindings[ eventType ] = true;
|
|
|
|
// If this is the first virtual mouse event for this type,
|
|
// register a global handler on the document.
|
|
|
|
activeDocHandlers[ eventType ] = ( activeDocHandlers[ eventType ] || 0 ) + 1;
|
|
|
|
if ( activeDocHandlers[ eventType ] === 1 ) {
|
|
$document.bind( realType, mouseEventCallback );
|
|
}
|
|
|
|
// Some browsers, like Opera Mini, won't dispatch mouse/click events
|
|
// for elements unless they actually have handlers registered on them.
|
|
// To get around this, we register dummy handlers on the elements.
|
|
|
|
$( this ).bind( realType, dummyMouseHandler );
|
|
|
|
// For now, if event capture is not supported, we rely on mouse handlers.
|
|
if ( eventCaptureSupported ) {
|
|
// If this is the first virtual mouse binding for the document,
|
|
// register our touchstart handler on the document.
|
|
|
|
activeDocHandlers[ "touchstart" ] = ( activeDocHandlers[ "touchstart" ] || 0) + 1;
|
|
|
|
if ( activeDocHandlers[ "touchstart" ] === 1 ) {
|
|
$document.bind( "touchstart", handleTouchStart )
|
|
.bind( "touchend", handleTouchEnd )
|
|
|
|
// On touch platforms, touching the screen and then dragging your finger
|
|
// causes the window content to scroll after some distance threshold is
|
|
// exceeded. On these platforms, a scroll prevents a click event from being
|
|
// dispatched, and on some platforms, even the touchend is suppressed. To
|
|
// mimic the suppression of the click event, we need to watch for a scroll
|
|
// event. Unfortunately, some platforms like iOS don't dispatch scroll
|
|
// events until *AFTER* the user lifts their finger (touchend). This means
|
|
// we need to watch both scroll and touchmove events to figure out whether
|
|
// or not a scroll happenens before the touchend event is fired.
|
|
|
|
.bind( "touchmove", handleTouchMove )
|
|
.bind( "scroll", handleScroll );
|
|
}
|
|
}
|
|
},
|
|
|
|
teardown: function( data, namespace ) {
|
|
// If this is the last virtual binding for this eventType,
|
|
// remove its global handler from the document.
|
|
|
|
--activeDocHandlers[ eventType ];
|
|
|
|
if ( !activeDocHandlers[ eventType ] ) {
|
|
$document.unbind( realType, mouseEventCallback );
|
|
}
|
|
|
|
if ( eventCaptureSupported ) {
|
|
// If this is the last virtual mouse binding in existence,
|
|
// remove our document touchstart listener.
|
|
|
|
--activeDocHandlers[ "touchstart" ];
|
|
|
|
if ( !activeDocHandlers[ "touchstart" ] ) {
|
|
$document.unbind( "touchstart", handleTouchStart )
|
|
.unbind( "touchmove", handleTouchMove )
|
|
.unbind( "touchend", handleTouchEnd )
|
|
.unbind( "scroll", handleScroll );
|
|
}
|
|
}
|
|
|
|
var $this = $( this ),
|
|
bindings = $.data( this, dataPropertyName );
|
|
|
|
// teardown may be called when an element was
|
|
// removed from the DOM. If this is the case,
|
|
// jQuery core may have already stripped the element
|
|
// of any data bindings so we need to check it before
|
|
// using it.
|
|
if ( bindings ) {
|
|
bindings[ eventType ] = false;
|
|
}
|
|
|
|
// Unregister the dummy event handler.
|
|
|
|
$this.unbind( realType, dummyMouseHandler );
|
|
|
|
// If this is the last virtual mouse binding on the
|
|
// element, remove the binding data from the element.
|
|
|
|
if ( !hasVirtualBindings( this ) ) {
|
|
$this.removeData( dataPropertyName );
|
|
}
|
|
}
|
|
};
|
|
}
|
|
|
|
// Expose our custom events to the jQuery bind/unbind mechanism.
|
|
|
|
for ( var i = 0; i < virtualEventNames.length; i++ ) {
|
|
$.event.special[ virtualEventNames[ i ] ] = getSpecialEventObject( virtualEventNames[ i ] );
|
|
}
|
|
|
|
// Add a capture click handler to block clicks.
|
|
// Note that we require event capture support for this so if the device
|
|
// doesn't support it, we punt for now and rely solely on mouse events.
|
|
if ( eventCaptureSupported ) {
|
|
document.addEventListener( "click", function( e ) {
|
|
var cnt = clickBlockList.length,
|
|
target = e.target,
|
|
x, y, ele, i, o, touchID;
|
|
|
|
if ( cnt ) {
|
|
x = e.clientX;
|
|
y = e.clientY;
|
|
threshold = $.vmouse.clickDistanceThreshold;
|
|
|
|
// The idea here is to run through the clickBlockList to see if
|
|
// the current click event is in the proximity of one of our
|
|
// vclick events that had preventDefault() called on it. If we find
|
|
// one, then we block the click.
|
|
//
|
|
// Why do we have to rely on proximity?
|
|
//
|
|
// Because the target of the touch event that triggered the vclick
|
|
// can be different from the target of the click event synthesized
|
|
// by the browser. The target of a mouse/click event that is syntehsized
|
|
// from a touch event seems to be implementation specific. For example,
|
|
// some browsers will fire mouse/click events for a link that is near
|
|
// a touch event, even though the target of the touchstart/touchend event
|
|
// says the user touched outside the link. Also, it seems that with most
|
|
// browsers, the target of the mouse/click event is not calculated until the
|
|
// time it is dispatched, so if you replace an element that you touched
|
|
// with another element, the target of the mouse/click will be the new
|
|
// element underneath that point.
|
|
//
|
|
// Aside from proximity, we also check to see if the target and any
|
|
// of its ancestors were the ones that blocked a click. This is necessary
|
|
// because of the strange mouse/click target calculation done in the
|
|
// Android 2.1 browser, where if you click on an element, and there is a
|
|
// mouse/click handler on one of its ancestors, the target will be the
|
|
// innermost child of the touched element, even if that child is no where
|
|
// near the point of touch.
|
|
|
|
ele = target;
|
|
|
|
while ( ele ) {
|
|
for ( i = 0; i < cnt; i++ ) {
|
|
o = clickBlockList[ i ];
|
|
touchID = 0;
|
|
|
|
if ( ( ele === target && Math.abs( o.x - x ) < threshold && Math.abs( o.y - y ) < threshold ) ||
|
|
$.data( ele, touchTargetPropertyName ) === o.touchID ) {
|
|
// XXX: We may want to consider removing matches from the block list
|
|
// instead of waiting for the reset timer to fire.
|
|
e.preventDefault();
|
|
e.stopPropagation();
|
|
return;
|
|
}
|
|
}
|
|
ele = ele.parentNode;
|
|
}
|
|
}
|
|
}, true);
|
|
}
|
|
})( jQuery, window, document );
|
|
|
|
|
|
(function( $, window, undefined ) {
|
|
// add new event shortcuts
|
|
$.each( ( "touchstart touchmove touchend " +
|
|
"tap taphold " +
|
|
"swipe swipeleft swiperight " +
|
|
"scrollstart scrollstop" ).split( " " ), function( i, name ) {
|
|
|
|
$.fn[ name ] = function( fn ) {
|
|
return fn ? this.bind( name, fn ) : this.trigger( name );
|
|
};
|
|
|
|
// jQuery < 1.8
|
|
if ( $.attrFn ) {
|
|
$.attrFn[ name ] = true;
|
|
}
|
|
});
|
|
|
|
var supportTouch = $.mobile.support.touch,
|
|
scrollEvent = "touchmove scroll",
|
|
touchStartEvent = supportTouch ? "touchstart" : "mousedown",
|
|
touchStopEvent = supportTouch ? "touchend" : "mouseup",
|
|
touchMoveEvent = supportTouch ? "touchmove" : "mousemove";
|
|
|
|
function triggerCustomEvent( obj, eventType, event ) {
|
|
var originalType = event.type;
|
|
event.type = eventType;
|
|
$.event.handle.call( obj, event );
|
|
event.type = originalType;
|
|
}
|
|
|
|
// also handles scrollstop
|
|
$.event.special.scrollstart = {
|
|
|
|
enabled: true,
|
|
|
|
setup: function() {
|
|
|
|
var thisObject = this,
|
|
$this = $( thisObject ),
|
|
scrolling,
|
|
timer;
|
|
|
|
function trigger( event, state ) {
|
|
scrolling = state;
|
|
triggerCustomEvent( thisObject, scrolling ? "scrollstart" : "scrollstop", event );
|
|
}
|
|
|
|
// iPhone triggers scroll after a small delay; use touchmove instead
|
|
$this.bind( scrollEvent, function( event ) {
|
|
|
|
if ( !$.event.special.scrollstart.enabled ) {
|
|
return;
|
|
}
|
|
|
|
if ( !scrolling ) {
|
|
trigger( event, true );
|
|
}
|
|
|
|
clearTimeout( timer );
|
|
timer = setTimeout( function() {
|
|
trigger( event, false );
|
|
}, 50 );
|
|
});
|
|
}
|
|
};
|
|
|
|
// also handles taphold
|
|
$.event.special.tap = {
|
|
tapholdThreshold: 750,
|
|
|
|
setup: function() {
|
|
var thisObject = this,
|
|
$this = $( thisObject );
|
|
|
|
$this.bind( "vmousedown", function( event ) {
|
|
|
|
if ( event.which && event.which !== 1 ) {
|
|
return false;
|
|
}
|
|
|
|
var origTarget = event.target,
|
|
origEvent = event.originalEvent,
|
|
timer;
|
|
|
|
function clearTapTimer() {
|
|
clearTimeout( timer );
|
|
}
|
|
|
|
function clearTapHandlers() {
|
|
clearTapTimer();
|
|
|
|
$this.unbind( "vclick", clickHandler )
|
|
.unbind( "vmouseup", clearTapTimer );
|
|
$( document ).unbind( "vmousecancel", clearTapHandlers );
|
|
}
|
|
|
|
function clickHandler( event ) {
|
|
clearTapHandlers();
|
|
|
|
// ONLY trigger a 'tap' event if the start target is
|
|
// the same as the stop target.
|
|
if ( origTarget === event.target ) {
|
|
triggerCustomEvent( thisObject, "tap", event );
|
|
}
|
|
}
|
|
|
|
$this.bind( "vmouseup", clearTapTimer )
|
|
.bind( "vclick", clickHandler );
|
|
$( document ).bind( "vmousecancel", clearTapHandlers );
|
|
|
|
timer = setTimeout( function() {
|
|
triggerCustomEvent( thisObject, "taphold", $.Event( "taphold", { target: origTarget } ) );
|
|
}, $.event.special.tap.tapholdThreshold );
|
|
});
|
|
}
|
|
};
|
|
|
|
// also handles swipeleft, swiperight
|
|
$.event.special.swipe = {
|
|
scrollSupressionThreshold: 30, // More than this horizontal displacement, and we will suppress scrolling.
|
|
|
|
durationThreshold: 1000, // More time than this, and it isn't a swipe.
|
|
|
|
horizontalDistanceThreshold: 30, // Swipe horizontal displacement must be more than this.
|
|
|
|
verticalDistanceThreshold: 75, // Swipe vertical displacement must be less than this.
|
|
|
|
setup: function() {
|
|
var thisObject = this,
|
|
$this = $( thisObject );
|
|
|
|
$this.bind( touchStartEvent, function( event ) {
|
|
var data = event.originalEvent.touches ?
|
|
event.originalEvent.touches[ 0 ] : event,
|
|
start = {
|
|
time: ( new Date() ).getTime(),
|
|
coords: [ data.pageX, data.pageY ],
|
|
origin: $( event.target )
|
|
},
|
|
stop;
|
|
|
|
function moveHandler( event ) {
|
|
|
|
if ( !start ) {
|
|
return;
|
|
}
|
|
|
|
var data = event.originalEvent.touches ?
|
|
event.originalEvent.touches[ 0 ] : event;
|
|
|
|
stop = {
|
|
time: ( new Date() ).getTime(),
|
|
coords: [ data.pageX, data.pageY ]
|
|
};
|
|
|
|
// prevent scrolling
|
|
if ( Math.abs( start.coords[ 0 ] - stop.coords[ 0 ] ) > $.event.special.swipe.scrollSupressionThreshold ) {
|
|
event.preventDefault();
|
|
}
|
|
}
|
|
|
|
$this.bind( touchMoveEvent, moveHandler )
|
|
.one( touchStopEvent, function( event ) {
|
|
$this.unbind( touchMoveEvent, moveHandler );
|
|
|
|
if ( start && stop ) {
|
|
if ( stop.time - start.time < $.event.special.swipe.durationThreshold &&
|
|
Math.abs( start.coords[ 0 ] - stop.coords[ 0 ] ) > $.event.special.swipe.horizontalDistanceThreshold &&
|
|
Math.abs( start.coords[ 1 ] - stop.coords[ 1 ] ) < $.event.special.swipe.verticalDistanceThreshold ) {
|
|
|
|
start.origin.trigger( "swipe" )
|
|
.trigger( start.coords[0] > stop.coords[ 0 ] ? "swipeleft" : "swiperight" );
|
|
}
|
|
}
|
|
start = stop = undefined;
|
|
});
|
|
});
|
|
}
|
|
};
|
|
$.each({
|
|
scrollstop: "scrollstart",
|
|
taphold: "tap",
|
|
swipeleft: "swipe",
|
|
swiperight: "swipe"
|
|
}, function( event, sourceEvent ) {
|
|
|
|
$.event.special[ event ] = {
|
|
setup: function() {
|
|
$( this ).bind( sourceEvent, $.noop );
|
|
}
|
|
};
|
|
});
|
|
|
|
})( jQuery, this );
|
|
|
|
}));
|
|
/***************************************************************************************************************************/
|
|
/*
|
|
* jQuery UI Accordion 1.6
|
|
*
|
|
* Copyright (c) 2007 Jörn Zaefferer
|
|
*
|
|
* http://docs.jquery.com/UI/Accordion
|
|
*
|
|
* Dual licensed under the MIT and GPL licenses:
|
|
* http://www.opensource.org/licenses/mit-license.php
|
|
* http://www.gnu.org/licenses/gpl.html
|
|
*
|
|
* Revision: $Id: jquery.accordion.js 4876 2008-03-08 11:49:04Z joern.zaefferer $
|
|
*
|
|
*/
|
|
|
|
jQuery(document).ready( function($) {
|
|
|
|
// If the UI scope is not available, add it
|
|
$.ui = $.ui || {};
|
|
|
|
$.fn.extend({
|
|
accordion: function(options, data) {
|
|
var args = Array.prototype.slice.call(arguments, 1);
|
|
|
|
return this.each(function() {
|
|
if (typeof options == "string") {
|
|
var accordion = $.data(this, "ui-accordion");
|
|
accordion[options].apply(accordion, args);
|
|
// INIT with optional options
|
|
} else if (!$(this).is(".ui-accordion"))
|
|
$.data(this, "ui-accordion", new $.ui.accordion(this, options));
|
|
});
|
|
},
|
|
// deprecated, use accordion("activate", index) instead
|
|
activate: function(index) {
|
|
return this.accordion("activate", index);
|
|
}
|
|
});
|
|
|
|
$.ui.accordion = function(container, options) {
|
|
|
|
// setup configuration
|
|
this.options = options = $.extend({}, $.ui.accordion.defaults, options);
|
|
this.element = container;
|
|
|
|
$(container).addClass("ui-accordion");
|
|
|
|
if ( options.navigation ) {
|
|
var current = $(container).find(".accord > a").filter(options.navigationFilter);
|
|
if ( current.length ) {
|
|
if ( current.filter(options.header).length ) {
|
|
options.active = current;
|
|
} else {
|
|
options.active = current.parent().parent().prev();
|
|
current.addClass("current");
|
|
}
|
|
}
|
|
}
|
|
|
|
// calculate active if not specified, using the first header
|
|
options.headers = $(container).find(options.header);
|
|
options.active = findActive(options.headers, options.active);
|
|
|
|
if ( options.fillSpace ) {
|
|
var maxHeight = $(container).parent().height();
|
|
options.headers.each(function() {
|
|
maxHeight -= $(this).outerHeight();
|
|
});
|
|
var maxPadding = 0;
|
|
options.headers.next().each(function() {
|
|
maxPadding = Math.max(maxPadding, $(this).innerHeight() - $(this).height());
|
|
}).height(maxHeight - maxPadding);
|
|
} else if ( options.autoheight ) {
|
|
var maxHeight = 0;
|
|
options.headers.next().each(function() {
|
|
maxHeight = Math.max(maxHeight, $(this).outerHeight());
|
|
}).height(maxHeight);
|
|
}
|
|
|
|
options.headers
|
|
.not(options.active || "")
|
|
.next()
|
|
.hide();
|
|
options.active.parent().andSelf().addClass(options.selectedClass);
|
|
|
|
if (options.event)
|
|
$(container).bind((options.event) + ".ui-accordion", clickHandler);
|
|
};
|
|
|
|
$.ui.accordion.prototype = {
|
|
activate: function(index) {
|
|
// call clickHandler with custom event
|
|
clickHandler.call(this.element, {
|
|
target: findActive( this.options.headers, index )[0]
|
|
});
|
|
},
|
|
|
|
enable: function() {
|
|
this.options.disabled = false;
|
|
},
|
|
disable: function() {
|
|
this.options.disabled = true;
|
|
},
|
|
destroy: function() {
|
|
this.options.headers.next().css("display", "");
|
|
if ( this.options.fillSpace || this.options.autoheight ) {
|
|
this.options.headers.next().css("height", "");
|
|
}
|
|
$.removeData(this.element, "ui-accordion");
|
|
$(this.element).removeClass("ui-accordion").unbind(".ui-accordion");
|
|
}
|
|
}
|
|
|
|
function scopeCallback(callback, scope) {
|
|
return function() {
|
|
return callback.apply(scope, arguments);
|
|
};
|
|
}
|
|
|
|
function completed(cancel) {
|
|
// if removed while animated data can be empty
|
|
if (!$.data(this, "ui-accordion"))
|
|
return;
|
|
var instance = $.data(this, "ui-accordion");
|
|
var options = instance.options;
|
|
options.running = cancel ? 0 : --options.running;
|
|
if ( options.running )
|
|
return;
|
|
if ( options.clearStyle ) {
|
|
options.toShow.add(options.toHide).css({
|
|
height: "",
|
|
overflow: ""
|
|
});
|
|
}
|
|
$(this).triggerHandler("change.ui-accordion", [options.data], options.change);
|
|
}
|
|
|
|
function toggle(toShow, toHide, data, clickedActive, down) {
|
|
var options = $.data(this, "ui-accordion").options;
|
|
options.toShow = toShow;
|
|
options.toHide = toHide;
|
|
options.data = data;
|
|
var complete = scopeCallback(completed, this);
|
|
|
|
// count elements to animate
|
|
options.running = toHide.size() == 0 ? toShow.size() : toHide.size();
|
|
|
|
if ( options.animated ) {
|
|
if ( !options.alwaysOpen && clickedActive ) {
|
|
$.ui.accordion.animations[options.animated]({
|
|
toShow: jQuery([]),
|
|
toHide: toHide,
|
|
complete: complete,
|
|
down: down,
|
|
autoheight: options.autoheight
|
|
});
|
|
} else {
|
|
$.ui.accordion.animations[options.animated]({
|
|
toShow: toShow,
|
|
toHide: toHide,
|
|
complete: complete,
|
|
down: down,
|
|
autoheight: options.autoheight
|
|
});
|
|
}
|
|
} else {
|
|
if ( !options.alwaysOpen && clickedActive ) {
|
|
toShow.toggle();
|
|
} else {
|
|
toHide.hide();
|
|
toShow.show();
|
|
}
|
|
complete(true);
|
|
}
|
|
}
|
|
|
|
function clickHandler(event) {
|
|
var options = $.data(this, "ui-accordion").options;
|
|
if (options.disabled)
|
|
return false;
|
|
|
|
// called only when using activate(false) to close all parts programmatically
|
|
if ( !event.target && !options.alwaysOpen ) {
|
|
options.active.parent().andSelf().toggleClass(options.selectedClass);
|
|
var toHide = options.active.next(),
|
|
data = {
|
|
instance: this,
|
|
options: options,
|
|
newHeader: jQuery([]),
|
|
oldHeader: options.active,
|
|
newContent: jQuery([]),
|
|
oldContent: toHide
|
|
},
|
|
toShow = options.active = $([]);
|
|
toggle.call(this, toShow, toHide, data );
|
|
return false;
|
|
}
|
|
// get the click target
|
|
var clicked = $(event.target);
|
|
|
|
// due to the event delegation model, we have to check if one
|
|
// of the parent elements is our actual header, and find that
|
|
if ( clicked.parents(options.header).length )
|
|
while ( !clicked.is(options.header) )
|
|
clicked = clicked.parent();
|
|
|
|
var clickedActive = clicked[0] == options.active[0];
|
|
|
|
// if animations are still active, or the active header is the target, ignore click
|
|
if (options.running || (options.alwaysOpen && clickedActive))
|
|
return false;
|
|
if (!clicked.is(options.header))
|
|
return;
|
|
|
|
// switch classes
|
|
options.active.parent().andSelf().toggleClass(options.selectedClass);
|
|
if ( !clickedActive ) {
|
|
clicked.parent().andSelf().addClass(options.selectedClass);
|
|
}
|
|
|
|
// find elements to show and hide
|
|
var toShow = clicked.next(),
|
|
toHide = options.active.next(),
|
|
//data = [clicked, options.active, toShow, toHide],
|
|
data = {
|
|
instance: this,
|
|
options: options,
|
|
newHeader: clicked,
|
|
oldHeader: options.active,
|
|
newContent: toShow,
|
|
oldContent: toHide
|
|
},
|
|
down = options.headers.index( options.active[0] ) > options.headers.index( clicked[0] );
|
|
|
|
options.active = clickedActive ? $([]) : clicked;
|
|
toggle.call(this, toShow, toHide, data, clickedActive, down );
|
|
|
|
return false;
|
|
};
|
|
|
|
function findActive(headers, selector) {
|
|
return selector != undefined
|
|
? typeof selector == "number"
|
|
? headers.filter(":eq(" + selector + ")")
|
|
: headers.not(headers.not(selector))
|
|
: selector === false
|
|
? $([])
|
|
: headers.filter(":eq(0)");
|
|
}
|
|
|
|
$.extend($.ui.accordion, {
|
|
defaults: {
|
|
selectedClass: "selected",
|
|
alwaysOpen: true,
|
|
animated: 'slide',
|
|
event: "click",
|
|
header: ".accord > a",
|
|
autoheight: true,
|
|
running: 0,
|
|
navigationFilter: function() {
|
|
return this.href.toLowerCase() == location.href.toLowerCase();
|
|
}
|
|
},
|
|
animations: {
|
|
slide: function(options, additions) {
|
|
options = $.extend({
|
|
easing: "swing",
|
|
duration: 300
|
|
}, options, additions);
|
|
if ( !options.toHide.size() ) {
|
|
options.toShow.animate({height: "show"}, options);
|
|
return;
|
|
}
|
|
var hideHeight = options.toHide.height(),
|
|
showHeight = options.toShow.height(),
|
|
difference = showHeight / hideHeight;
|
|
options.toShow.css({ height: 0, overflow: 'hidden' }).show();
|
|
options.toHide.filter(":hidden").each(options.complete).end().filter(":visible").animate({height:"hide"},{
|
|
step: function(now) {
|
|
var current = (hideHeight - now) * difference;
|
|
if ($.browser.msie || $.browser.opera) {
|
|
current = Math.ceil(current);
|
|
}
|
|
options.toShow.height( current );
|
|
},
|
|
duration: options.duration,
|
|
easing: options.easing,
|
|
complete: function() {
|
|
if ( !options.autoheight ) {
|
|
options.toShow.css("height", "auto");
|
|
}
|
|
options.complete();
|
|
}
|
|
});
|
|
},
|
|
bounceslide: function(options) {
|
|
this.slide(options, {
|
|
easing: options.down ? "bounceout" : "swing",
|
|
duration: options.down ? 1000 : 200
|
|
});
|
|
},
|
|
easeslide: function(options) {
|
|
this.slide(options, {
|
|
easing: "easeinout",
|
|
duration: 700
|
|
})
|
|
}
|
|
}
|
|
});
|
|
|
|
});
|
|
|
|
/*********************************************************************************************************************************/
|
|
jQuery(document).ready( function($) {
|
|
|
|
$.organicTabs = function(el, options) {
|
|
|
|
var base = this;
|
|
base.$el = $(el);
|
|
base.$nav = base.$el.find(".nav-tab");
|
|
|
|
base.init = function() {
|
|
|
|
base.options = $.extend({},$.organicTabs.defaultOptions, options);
|
|
var curList = base.$el.find("a.current");
|
|
|
|
if( !curList || !curList.length )
|
|
base.$el.find("a:first").addClass('current');
|
|
base.$el.find("li:first").addClass('current');
|
|
|
|
// Accessible hiding fix
|
|
$(".hide").css({
|
|
"position": "relative",
|
|
"top": 0,
|
|
"left": 0,
|
|
"display": "none"
|
|
});
|
|
|
|
base.$nav.delegate("li > a", "click", function() {
|
|
// Figure out current list via CSS class
|
|
var curList = base.$el.find("a.current").attr("href").substring(1),
|
|
|
|
// List moving to
|
|
$newList = $(this),
|
|
|
|
// Figure out ID of new list
|
|
listID = $newList.attr("href").substring(1),
|
|
|
|
// Set outer wrapper height to (static) height of current inner list
|
|
$allListWrap = base.$el.find(".list-wrap"),
|
|
curListHeight = $allListWrap.height();
|
|
|
|
//$allListWrap.height(curListHeight);
|
|
|
|
if ((listID != curList) && ( base.$el.find(":animated").length == 0)) {
|
|
|
|
// Fade out current list
|
|
base.$el.find("."+curList).fadeOut(base.options.speed, function() {
|
|
|
|
// Fade in new list on callback
|
|
base.$el.find("."+listID).fadeIn(base.options.speed);
|
|
|
|
// Adjust outer wrapper to fit new list snuggly
|
|
var newHeight = base.$el.find("."+listID).height();
|
|
/*$allListWrap.animate({
|
|
height: newHeight
|
|
});*/
|
|
|
|
// Remove highlighting - Add to just-clicked tab
|
|
base.$el.find(".nav-tab li a").removeClass("current");
|
|
base.$el.find(".nav-tab li").removeClass("current");
|
|
$newList.addClass("current");
|
|
$newList.parent('li').addClass("current");
|
|
|
|
});
|
|
|
|
}
|
|
|
|
// Don't behave like a regular link
|
|
// Stop propegation and bubbling
|
|
return false;
|
|
});
|
|
|
|
};
|
|
base.init();
|
|
};
|
|
|
|
$.organicTabs.defaultOptions = {
|
|
"speed": 300
|
|
};
|
|
|
|
$.fn.organicTabs = function(options) {
|
|
return this.each(function() {
|
|
(new $.organicTabs(this, options));
|
|
});
|
|
};
|
|
|
|
});
|
|
|
|
/*********************************************************************************************************************************/
|
|
/**
|
|
* jQuery bxSlider v3.0
|
|
* http://bxslider.com
|
|
*
|
|
* Copyright 2011, Steven Wanderski
|
|
* http://bxcreative.com
|
|
*
|
|
* Free to use and abuse under the MIT license.
|
|
* http://www.opensource.org/licenses/mit-license.php
|
|
*
|
|
*/
|
|
|
|
(function($){
|
|
|
|
$.fn.bxSlider = function(options){
|
|
|
|
var defaults = {
|
|
mode: 'horizontal', // 'horizontal', 'vertical', 'fade'
|
|
childSelector: '', // jQuery selector - elements to be used as slides
|
|
infiniteLoop: true, // true, false - display first slide after last
|
|
hideControlOnEnd: false, // true, false - if true, will hide 'next' control on last slide and 'prev' control on first
|
|
controls: true, // true, false - previous and next controls
|
|
speed: 500, // integer - in ms, duration of time slide transitions will occupy
|
|
easing: 'swing', // used with jquery.easing.1.3.js - see http://gsgd.co.uk/sandbox/jquery/easing/ for available options
|
|
pager: false, // true / false - display a pager
|
|
pagerSelector: null, // jQuery selector - element to contain the pager. ex: '#pager'
|
|
pagerType: 'full', // 'full', 'short' - if 'full' pager displays 1,2,3... if 'short' pager displays 1 / 4
|
|
pagerLocation: 'bottom', // 'bottom', 'top' - location of pager
|
|
pagerShortSeparator: '/', // string - ex: 'of' pager would display 1 of 4
|
|
pagerActiveClass: 'pager-active', // string - classname attached to the active pager link
|
|
nextText: '', // string - text displayed for 'next' control
|
|
nextImage: '', // string - filepath of image used for 'next' control. ex: 'images/next.jpg'
|
|
nextSelector: null, // jQuery selector - element to contain the next control. ex: '#next'
|
|
prevText: '', // string - text displayed for 'previous' control
|
|
prevImage: '', // string - filepath of image used for 'previous' control. ex: 'images/prev.jpg'
|
|
prevSelector: null, // jQuery selector - element to contain the previous control. ex: '#next'
|
|
captions: false, // true, false - display image captions (reads the image 'title' tag)
|
|
captionsSelector: null, // jQuery selector - element to contain the captions. ex: '#captions'
|
|
auto: false, // true, false - make slideshow change automatically
|
|
autoDirection: 'next', // 'next', 'prev' - direction in which auto show will traverse
|
|
autoControls: false, // true, false - show 'start' and 'stop' controls for auto show
|
|
autoControlsSelector: null, // jQuery selector - element to contain the auto controls. ex: '#auto-controls'
|
|
autoStart: true, // true, false - if false show will wait for 'start' control to activate
|
|
autoHover: true, // true, false - if true show will pause on mouseover
|
|
autoDelay: 0, // integer - in ms, the amount of time before starting the auto show
|
|
pause: 3000, // integer - in ms, the duration between each slide transition
|
|
startText: 'start', // string - text displayed for 'start' control
|
|
startImage: '', // string - filepath of image used for 'start' control. ex: 'images/start.jpg'
|
|
stopText: 'stop', // string - text displayed for 'stop' control
|
|
stopImage: '', // string - filepath of image used for 'stop' control. ex: 'images/stop.jpg'
|
|
ticker: false, // true, false - continuous motion ticker mode (think news ticker)
|
|
// note: autoControls, autoControlsSelector, and autoHover apply to ticker!
|
|
tickerSpeed: 5000, // float - use value between 1 and 5000 to determine ticker speed - the smaller the value the faster the ticker speed
|
|
tickerDirection: 'next', // 'next', 'prev' - direction in which ticker show will traverse
|
|
tickerHover: false, // true, false - if true ticker will pause on mouseover
|
|
wrapperClass: 'bx-wrapper', // string - classname attached to the slider wraper
|
|
startingSlide: 0, // integer - show will start on specified slide. note: slides are zero based!
|
|
displaySlideQty: 1, // integer - number of slides to display at once
|
|
moveSlideQty: 1, // integer - number of slides to move at once
|
|
randomStart: false, // true, false - if true show will start on a random slide
|
|
onBeforeSlide: function(){}, // function(currentSlideNumber, totalSlideQty, currentSlideHtmlObject) - advanced use only! see the tutorial here: http://bxslider.com/custom-pager
|
|
onAfterSlide: function(){}, // function(currentSlideNumber, totalSlideQty, currentSlideHtmlObject) - advanced use only! see the tutorial here: http://bxslider.com/custom-pager
|
|
onLastSlide: function(){}, // function(currentSlideNumber, totalSlideQty, currentSlideHtmlObject) - advanced use only! see the tutorial here: http://bxslider.com/custom-pager
|
|
onFirstSlide: function(){}, // function(currentSlideNumber, totalSlideQty, currentSlideHtmlObject) - advanced use only! see the tutorial here: http://bxslider.com/custom-pager
|
|
onNextSlide: function(){}, // function(currentSlideNumber, totalSlideQty, currentSlideHtmlObject) - advanced use only! see the tutorial here: http://bxslider.com/custom-pager
|
|
onPrevSlide: function(){},
|
|
onInit: function(){},
|
|
onDestroy: function(){}, // function(currentSlideNumber, totalSlideQty, currentSlideHtmlObject) - advanced use only! see the tutorial here: http://bxslider.com/custom-pager
|
|
buildPager: null // function(slideIndex, slideHtmlObject){ return string; } - advanced use only! see the tutorial here: http://bxslider.com/custom-pager
|
|
};
|
|
|
|
var options = $.extend(defaults, options);
|
|
|
|
// cache the base element
|
|
var base = this;
|
|
// initialize (and localize) all variables
|
|
var $parent = '';
|
|
var $origElement = '';
|
|
var $children = '';
|
|
var this_children_Length = '';
|
|
var $outerWrapper = '';
|
|
var $firstChild = '';
|
|
var childrenWidth = '';
|
|
var childrenOuterWidth = '';
|
|
var wrapperWidth = '';
|
|
var wrapperHeight = '';
|
|
var $pager = '';
|
|
var interval = '';
|
|
var $autoControls = '';
|
|
var $stopHtml = '';
|
|
var $startContent = '';
|
|
var $stopContent = '';
|
|
var autoPlaying = true;
|
|
var loaded = false;
|
|
var childrenMaxWidth = 0;
|
|
var childrenMaxHeight = 0;
|
|
var currentSlide = 0;
|
|
var origLeft = 0;
|
|
var origTop = 0;
|
|
var origShowWidth = 0;
|
|
var origShowHeight = 0;
|
|
var tickerLeft = 0;
|
|
var tickerTop = 0;
|
|
var isWorking = false;
|
|
|
|
var firstSlide = 0;
|
|
var lastSlide = $children.length - 1;
|
|
|
|
|
|
// PUBLIC FUNCTIONS
|
|
|
|
/**
|
|
* Go to specified slide
|
|
*/
|
|
this.goToSlide = function(number, stopAuto){
|
|
if(!isWorking){
|
|
isWorking = true;
|
|
// set current slide to argument
|
|
currentSlide = number;
|
|
options.onBeforeSlide(currentSlide, $children.length, $children.eq(currentSlide));
|
|
// check if stopAuto argument is supplied
|
|
if(typeof(stopAuto) == 'undefined'){
|
|
var stopAuto = true;
|
|
}
|
|
if(stopAuto){
|
|
// if show is auto playing, stop it
|
|
if(options.auto){
|
|
base.stopShow(true);
|
|
}
|
|
}
|
|
slide = number;
|
|
// check for first slide callback
|
|
if(slide == firstSlide){
|
|
options.onFirstSlide(currentSlide, $children.length, $children.eq(currentSlide));
|
|
}
|
|
// check for last slide callback
|
|
if(slide == lastSlide){
|
|
options.onLastSlide(currentSlide, $children.length, $children.eq(currentSlide));
|
|
}
|
|
// horizontal
|
|
if(options.mode == 'horizontal'){
|
|
$parent.animate({'left': '-'+getSlidePosition(slide, 'left')+'px'}, options.speed, options.easing, function(){
|
|
isWorking = false;
|
|
// perform the callback function
|
|
options.onAfterSlide(currentSlide, $children.length, $children.eq(currentSlide));
|
|
});
|
|
// vertical
|
|
}else if(options.mode == 'vertical'){
|
|
$parent.animate({'top': '-'+getSlidePosition(slide, 'top')+'px'}, options.speed, options.easing, function(){
|
|
isWorking = false;
|
|
// perform the callback function
|
|
options.onAfterSlide(currentSlide, $children.length, $children.eq(currentSlide));
|
|
});
|
|
// fade
|
|
}else if(options.mode == 'fade'){
|
|
setChildrenFade();
|
|
}
|
|
// check to remove controls on last/first slide
|
|
checkEndControls();
|
|
// accomodate multi slides
|
|
if(options.moveSlideQty > 1){
|
|
number = Math.floor(number / options.moveSlideQty);
|
|
}
|
|
// make the current slide active
|
|
makeSlideActive(number);
|
|
// display the caption
|
|
showCaptions();
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Go to next slide
|
|
*/
|
|
this.goToNextSlide = function(stopAuto){
|
|
// check if stopAuto argument is supplied
|
|
if(typeof(stopAuto) == 'undefined'){
|
|
var stopAuto = true;
|
|
}
|
|
if(stopAuto){
|
|
// if show is auto playing, stop it
|
|
if(options.auto){
|
|
base.stopShow(true);
|
|
}
|
|
}
|
|
// makes slideshow finite
|
|
if(!options.infiniteLoop){
|
|
if(!isWorking){
|
|
var slideLoop = false;
|
|
// make current slide the old value plus moveSlideQty
|
|
currentSlide = (currentSlide + (options.moveSlideQty));
|
|
// if current slide has looped on itself
|
|
if(currentSlide <= lastSlide){
|
|
checkEndControls();
|
|
// next slide callback
|
|
options.onNextSlide(currentSlide, $children.length, $children.eq(currentSlide));
|
|
// move to appropriate slide
|
|
base.goToSlide(currentSlide);
|
|
}else{
|
|
currentSlide -= options.moveSlideQty;
|
|
}
|
|
} // end if(!isWorking)
|
|
}else{
|
|
if(!isWorking){
|
|
isWorking = true;
|
|
var slideLoop = false;
|
|
// make current slide the old value plus moveSlideQty
|
|
currentSlide = (currentSlide + options.moveSlideQty);
|
|
// if current slide has looped on itself
|
|
if(currentSlide > lastSlide){
|
|
currentSlide = currentSlide % $children.length;
|
|
slideLoop = true;
|
|
}
|
|
// next slide callback
|
|
options.onNextSlide(currentSlide, $children.length, $children.eq(currentSlide));
|
|
// slide before callback
|
|
options.onBeforeSlide(currentSlide, $children.length, $children.eq(currentSlide));
|
|
if(options.mode == 'horizontal'){
|
|
// get the new 'left' property for $parent
|
|
var parentLeft = (options.moveSlideQty * childrenOuterWidth);
|
|
// animate to the new 'left'
|
|
$parent.animate({'left': '-='+parentLeft+'px'}, options.speed, options.easing, function(){
|
|
isWorking = false;
|
|
// if its time to loop, reset the $parent
|
|
if(slideLoop){
|
|
$parent.css('left', '-'+getSlidePosition(currentSlide, 'left')+'px');
|
|
}
|
|
// perform the callback function
|
|
options.onAfterSlide(currentSlide, $children.length, $children.eq(currentSlide));
|
|
});
|
|
}else if(options.mode == 'vertical'){
|
|
// get the new 'left' property for $parent
|
|
var parentTop = (options.moveSlideQty * childrenMaxHeight);
|
|
// animate to the new 'left'
|
|
$parent.animate({'top': '-='+parentTop+'px'}, options.speed, options.easing, function(){
|
|
isWorking = false;
|
|
// if its time to loop, reset the $parent
|
|
if(slideLoop){
|
|
$parent.css('top', '-'+getSlidePosition(currentSlide, 'top')+'px');
|
|
}
|
|
// perform the callback function
|
|
options.onAfterSlide(currentSlide, $children.length, $children.eq(currentSlide));
|
|
});
|
|
}else if(options.mode == 'fade'){
|
|
setChildrenFade();
|
|
}
|
|
// make the current slide active
|
|
if(options.moveSlideQty > 1){
|
|
makeSlideActive(Math.ceil(currentSlide / options.moveSlideQty));
|
|
}else{
|
|
makeSlideActive(currentSlide);
|
|
}
|
|
// display the caption
|
|
showCaptions();
|
|
} // end if(!isWorking)
|
|
|
|
}
|
|
|
|
} // end function
|
|
|
|
/**
|
|
* Go to previous slide
|
|
*/
|
|
this.goToPreviousSlide = function(stopAuto){
|
|
// check if stopAuto argument is supplied
|
|
if(typeof(stopAuto) == 'undefined'){
|
|
var stopAuto = true;
|
|
}
|
|
if(stopAuto){
|
|
// if show is auto playing, stop it
|
|
if(options.auto){
|
|
base.stopShow(true);
|
|
}
|
|
}
|
|
// makes slideshow finite
|
|
if(!options.infiniteLoop){
|
|
if(!isWorking){
|
|
var slideLoop = false;
|
|
// make current slide the old value plus moveSlideQty
|
|
currentSlide = currentSlide - options.moveSlideQty;
|
|
// if current slide has looped on itself
|
|
if(currentSlide < 0){
|
|
currentSlide = 0;
|
|
// if specified, hide the control on the last slide
|
|
if(options.hideControlOnEnd){
|
|
$outerWrapper.children('.prev').hide();
|
|
}
|
|
}
|
|
checkEndControls();
|
|
// next slide callback
|
|
options.onPrevSlide(currentSlide, $children.length, $children.eq(currentSlide));
|
|
// move to appropriate slide
|
|
base.goToSlide(currentSlide);
|
|
}
|
|
}else{
|
|
if(!isWorking){
|
|
isWorking = true;
|
|
var slideLoop = false;
|
|
// make current slide the old value plus moveSlideQty
|
|
currentSlide = (currentSlide - (options.moveSlideQty));
|
|
// if current slide has looped on itself
|
|
if(currentSlide < 0){
|
|
negativeOffset = (currentSlide % $children.length);
|
|
if(negativeOffset == 0){
|
|
currentSlide = 0;
|
|
}else{
|
|
currentSlide = ($children.length) + negativeOffset;
|
|
}
|
|
slideLoop = true;
|
|
}
|
|
// next slide callback
|
|
options.onPrevSlide(currentSlide, $children.length, $children.eq(currentSlide));
|
|
// slide before callback
|
|
options.onBeforeSlide(currentSlide, $children.length, $children.eq(currentSlide));
|
|
if(options.mode == 'horizontal'){
|
|
// get the new 'left' property for $parent
|
|
var parentLeft = (options.moveSlideQty * childrenOuterWidth);
|
|
// animate to the new 'left'
|
|
$parent.animate({'left': '+='+parentLeft+'px'}, options.speed, options.easing, function(){
|
|
isWorking = false;
|
|
// if its time to loop, reset the $parent
|
|
if(slideLoop){
|
|
$parent.css('left', '-'+getSlidePosition(currentSlide, 'left')+'px');
|
|
}
|
|
// perform the callback function
|
|
options.onAfterSlide(currentSlide, $children.length, $children.eq(currentSlide));
|
|
});
|
|
}else if(options.mode == 'vertical'){
|
|
// get the new 'left' property for $parent
|
|
var parentTop = (options.moveSlideQty * childrenMaxHeight);
|
|
// animate to the new 'left'
|
|
$parent.animate({'top': '+='+parentTop+'px'}, options.speed, options.easing, function(){
|
|
isWorking = false;
|
|
// if its time to loop, reset the $parent
|
|
if(slideLoop){
|
|
$parent.css('top', '-'+getSlidePosition(currentSlide, 'top')+'px');
|
|
}
|
|
// perform the callback function
|
|
options.onAfterSlide(currentSlide, $children.length, $children.eq(currentSlide));
|
|
});
|
|
}else if(options.mode == 'fade'){
|
|
setChildrenFade();
|
|
}
|
|
// make the current slide active
|
|
if(options.moveSlideQty > 1){
|
|
makeSlideActive(Math.ceil(currentSlide / options.moveSlideQty));
|
|
}else{
|
|
makeSlideActive(currentSlide);
|
|
}
|
|
// display the caption
|
|
showCaptions();
|
|
} // end if(!isWorking)
|
|
}
|
|
} // end function
|
|
|
|
/**
|
|
* Go to first slide
|
|
*/
|
|
this.goToFirstSlide = function(stopAuto){
|
|
// check if stopAuto argument is supplied
|
|
if(typeof(stopAuto) == 'undefined'){
|
|
var stopAuto = true;
|
|
}
|
|
base.goToSlide(firstSlide, stopAuto);
|
|
}
|
|
|
|
/**
|
|
|
|
* Go to last slide
|
|
*/
|
|
this.goToLastSlide = function(){
|
|
// check if stopAuto argument is supplied
|
|
if(typeof(stopAuto) == 'undefined'){
|
|
var stopAuto = true;
|
|
}
|
|
base.goToSlide(lastSlide, stopAuto);
|
|
}
|
|
|
|
/**
|
|
* Get the current slide
|
|
*/
|
|
this.getCurrentSlide = function(){
|
|
return currentSlide;
|
|
}
|
|
|
|
/**
|
|
* Get the total slide count
|
|
*/
|
|
this.getSlideCount = function(){
|
|
return $children.length;
|
|
}
|
|
|
|
/**
|
|
* Suspend the slideshow
|
|
*/
|
|
this.suspendShow = function(changeText){
|
|
clearInterval(interval);
|
|
// check if changeText argument is supplied
|
|
if(typeof(changeText) == 'undefined'){
|
|
var changeText = true;
|
|
}
|
|
if(changeText && options.autoControls){
|
|
$autoControls.html($startContent).removeClass('stop').addClass('start');
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Restart the suspended slideshow
|
|
*/
|
|
this.restartShow = function(changeText){
|
|
// check if changeText argument is supplied
|
|
if(typeof(changeText) == 'undefined'){
|
|
var changeText = true;
|
|
}
|
|
if(autoPlaying){
|
|
setAutoInterval();
|
|
}
|
|
if(changeText && options.autoControls){
|
|
$autoControls.html($stopContent).removeClass('start').addClass('stop');
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Stop the slideshow permanently
|
|
*/
|
|
this.stopShow = function(changeText){
|
|
autoPlaying = false;
|
|
this.suspendShow(changeText);
|
|
}
|
|
|
|
/**
|
|
* Start the slideshow
|
|
*/
|
|
this.startShow = function(changeText){
|
|
autoPlaying = true;
|
|
this.restartShow(changeText);
|
|
}
|
|
|
|
/**
|
|
* Stops the ticker
|
|
*/
|
|
this.stopTicker = function(changeText){
|
|
$parent.stop();
|
|
// check if changeText argument is supplied
|
|
if(typeof(changeText) == 'undefined'){
|
|
var changeText = true;
|
|
}
|
|
if(changeText && options.ticker){
|
|
$autoControls.html($startContent).removeClass('stop').addClass('start');
|
|
autoPlaying = false;
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Starts the ticker
|
|
*/
|
|
this.startTicker = function(changeText){
|
|
if(options.mode == 'horizontal'){
|
|
if(options.tickerDirection == 'next'){
|
|
// get the 'left' property where the ticker stopped
|
|
var stoppedLeft = parseInt($parent.css('left'));
|
|
// calculate the remaining distance the show must travel until the loop
|
|
var remainingDistance = (origShowWidth + stoppedLeft) + $children.eq(0).width();
|
|
}else if(options.tickerDirection == 'prev'){
|
|
// get the 'left' property where the ticker stopped
|
|
var stoppedLeft = -parseInt($parent.css('left'));
|
|
// calculate the remaining distance the show must travel until the loop
|
|
var remainingDistance = (stoppedLeft) - $children.eq(0).width();
|
|
}
|
|
// calculate the speed ratio to seamlessly finish the loop
|
|
var finishingSpeed = (remainingDistance * options.tickerSpeed) / origShowWidth;
|
|
// call the show
|
|
moveTheShow(tickerLeft, remainingDistance, finishingSpeed);
|
|
}else if(options.mode == 'vertical'){
|
|
if(options.tickerDirection == 'next'){
|
|
// get the 'top' property where the ticker stopped
|
|
var stoppedTop = parseInt($parent.css('top'));
|
|
// calculate the remaining distance the show must travel until the loop
|
|
var remainingDistance = (origShowHeight + stoppedTop) + $children.eq(0).height();
|
|
}else if(options.tickerDirection == 'prev'){
|
|
// get the 'left' property where the ticker stopped
|
|
var stoppedTop = -parseInt($parent.css('top'));
|
|
// calculate the remaining distance the show must travel until the loop
|
|
var remainingDistance = (stoppedTop) - $children.eq(0).height();
|
|
}
|
|
// calculate the speed ratio to seamlessly finish the loop
|
|
var finishingSpeed = (remainingDistance * options.tickerSpeed) / origShowHeight;
|
|
// call the show
|
|
moveTheShow(tickerTop, remainingDistance, finishingSpeed);
|
|
// check if changeText argument is supplied
|
|
if(typeof(changeText) == 'undefined'){
|
|
var changeText = true;
|
|
}
|
|
if(changeText && options.ticker){
|
|
$autoControls.html($stopContent).removeClass('start').addClass('stop');
|
|
autoPlaying = true;
|
|
}
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Initialize a new slideshow
|
|
*/
|
|
this.initShow = function(){
|
|
|
|
// reinitialize all variables
|
|
// base = this;
|
|
$parent = $(this);
|
|
$origElement = $parent.clone();
|
|
$children = $parent.children(options.childSelector);
|
|
$outerWrapper = '';
|
|
$firstChild = $parent.children(options.childSelector + ':first');
|
|
childrenWidth = $firstChild.width();
|
|
childrenMaxWidth = 0;
|
|
childrenOuterWidth = $firstChild.outerWidth();
|
|
childrenMaxHeight = 0;
|
|
wrapperWidth = getWrapperWidth();
|
|
wrapperHeight = getWrapperHeight();
|
|
isWorking = false;
|
|
$pager = '';
|
|
currentSlide = 0;
|
|
origLeft = 0;
|
|
origTop = 0;
|
|
interval = '';
|
|
$autoControls = '';
|
|
$stopHtml = '';
|
|
$startContent = '';
|
|
$stopContent = '';
|
|
autoPlaying = true;
|
|
loaded = false;
|
|
origShowWidth = 0;
|
|
origShowHeight = 0;
|
|
tickerLeft = 0;
|
|
tickerTop = 0;
|
|
|
|
firstSlide = 0;
|
|
lastSlide = $children.length - 1;
|
|
|
|
// get the largest child's height and width
|
|
$children.each(function(index) {
|
|
if($(this).outerHeight() > childrenMaxHeight){
|
|
childrenMaxHeight = $(this).outerHeight();
|
|
}
|
|
if($(this).outerWidth() > childrenMaxWidth){
|
|
childrenMaxWidth = $(this).outerWidth();
|
|
}
|
|
});
|
|
|
|
// get random slide number
|
|
if(options.randomStart){
|
|
var randomNumber = Math.floor(Math.random() * $children.length);
|
|
currentSlide = randomNumber;
|
|
origLeft = childrenOuterWidth * (options.moveSlideQty + randomNumber);
|
|
origTop = childrenMaxHeight * (options.moveSlideQty + randomNumber);
|
|
// start show at specific slide
|
|
}else{
|
|
currentSlide = options.startingSlide;
|
|
origLeft = childrenOuterWidth * (options.moveSlideQty + options.startingSlide);
|
|
origTop = childrenMaxHeight * (options.moveSlideQty + options.startingSlide);
|
|
}
|
|
|
|
// set initial css
|
|
initCss();
|
|
|
|
// check to show pager
|
|
if(options.pager && !options.ticker){
|
|
if(options.pagerType == 'full'){
|
|
showPager('full');
|
|
}else if(options.pagerType == 'short'){
|
|
showPager('short');
|
|
}
|
|
}
|
|
|
|
// check to show controls
|
|
if(options.controls && !options.ticker && $children.length > 1){
|
|
setControlsVars();
|
|
}
|
|
|
|
// check if auto
|
|
if(options.auto || options.ticker){
|
|
// check if auto controls are displayed
|
|
if(options.autoControls){
|
|
setAutoControlsVars();
|
|
}
|
|
// check if show should auto start
|
|
if(options.autoStart){
|
|
// check if autostart should delay
|
|
autoPlaying = false; // prevent playing during the deplay
|
|
setTimeout(function(){
|
|
base.startShow(true);
|
|
}, options.autoDelay);
|
|
}else{
|
|
base.stopShow(true);
|
|
}
|
|
// check if show should pause on hover
|
|
if(options.autoHover && !options.ticker){
|
|
setAutoHover();
|
|
}
|
|
}
|
|
// make the starting slide active
|
|
if(options.moveSlideQty > 1){
|
|
makeSlideActive(Math.ceil(currentSlide / options.moveSlideQty));
|
|
}else{
|
|
makeSlideActive(currentSlide);
|
|
}
|
|
// check for finite show and if controls should be hidden
|
|
checkEndControls();
|
|
// show captions
|
|
if(options.captions){
|
|
showCaptions();
|
|
}
|
|
// perform the callback function
|
|
options.onAfterSlide(currentSlide, $children.length, $children.eq(currentSlide));
|
|
|
|
options.onInit(currentSlide, $children.length, $children.eq(currentSlide));
|
|
|
|
}
|
|
|
|
/**
|
|
* Destroy the current slideshow
|
|
*/
|
|
this.destroyShow = function(){
|
|
// stop the auto show
|
|
clearInterval(interval);
|
|
// remove any controls / pagers that have been appended
|
|
$outerWrapper.children('.next, .prev, .bx-pager, .bx-auto').remove();
|
|
// unwrap all bx-wrappers
|
|
$parent.unwrap().unwrap().removeAttr('style');
|
|
// remove any styles that were appended
|
|
$parent.children(options.childSelector).removeAttr('style').not('.bx-child').remove();
|
|
// remove any childrent that were appended
|
|
$children.removeClass('bx-child');
|
|
$children.removeClass('clones');
|
|
options.onDestroy();
|
|
}
|
|
|
|
/**
|
|
* Reload the current slideshow
|
|
*/
|
|
this.reloadShow = function(){
|
|
base.destroyShow();
|
|
base.initShow();
|
|
}
|
|
|
|
// PRIVATE FUNCTIONS
|
|
|
|
|
|
/**
|
|
* Creates all neccessary styling for the slideshow
|
|
*/
|
|
function initCss(){
|
|
// layout the children
|
|
setChildrenLayout(options.startingSlide);
|
|
// CSS for horizontal mode
|
|
if(options.mode == 'horizontal'){
|
|
// wrap the <ul> in div that acts as a window and make the <ul> uber wide
|
|
$parent
|
|
.wrap('<div class="'+options.wrapperClass+'" style="width:'+wrapperWidth+'px; position:relative;"></div>')
|
|
.wrap('<div class="bx-window" style="position:relative; overflow:hidden; width:'+wrapperWidth+'px; "></div>')
|
|
.css({
|
|
width: '999999px',
|
|
position: 'relative',
|
|
left: '-'+(options.infiniteLoop ? origLeft : 0)+'px'
|
|
});
|
|
$parent.children(options.childSelector).css({
|
|
width: childrenWidth,
|
|
'float': 'left',
|
|
listStyle: 'none'
|
|
});
|
|
$outerWrapper = $parent.parent().parent();
|
|
$children.addClass('bx-child');
|
|
|
|
|
|
// CSS for vertical mode
|
|
}else if(options.mode == 'vertical'){
|
|
// wrap the <ul> in div that acts as a window and make the <ul> uber tall
|
|
$parent
|
|
.wrap('<div class="'+options.wrapperClass+'" style="width:'+childrenMaxWidth+'px; position:relative;"></div>')
|
|
// .wrap('<div class="bx-window" style="width:'+childrenMaxWidth+'px; height:'+wrapperHeight+'px; position:relative; overflow:hidden;"></div>')
|
|
.wrap('<div class="bx-window" style="width:'+childrenMaxWidth+'px; position:relative; overflow:hidden;"></div>')
|
|
.css({
|
|
height: '999999px',
|
|
position: 'relative',
|
|
top: '-'+(origTop)+'px'
|
|
});
|
|
$parent.children(options.childSelector).css({
|
|
listStyle: 'none',
|
|
height: childrenMaxHeight
|
|
});
|
|
$outerWrapper = $parent.parent().parent();
|
|
$children.addClass('bx-child');
|
|
// CSS for fade mode
|
|
}else if(options.mode == 'fade'){
|
|
// wrap the <ul> in div that acts as a window
|
|
$parent
|
|
.wrap('<div class="'+options.wrapperClass+'" style="width:'+childrenMaxWidth+'px; position:relative;"></div>')
|
|
// .wrap('<div class="bx-window" style="height:'+childrenMaxHeight+'px; width:'+childrenMaxWidth+'px; position:relative; overflow:hidden;"></div>');
|
|
.wrap('<div class="bx-window" style="width:'+childrenMaxWidth+'px; position:relative; overflow:hidden;"></div>');
|
|
$parent.children(options.childSelector).css({
|
|
listStyle: 'none',
|
|
position: 'absolute',
|
|
top: 0,
|
|
left: 0,
|
|
zIndex: 98
|
|
});
|
|
$outerWrapper = $parent.parent().parent();
|
|
$children.not(':eq('+currentSlide+')').fadeTo(0, 0);
|
|
$children.eq(currentSlide).css('zIndex', 99);
|
|
}
|
|
// if captions = true setup a div placeholder
|
|
if(options.captions && options.captionsSelector == null){
|
|
$outerWrapper.append('<div class="bx-captions"></div>');
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
* Depending on mode, lays out children in the proper setup
|
|
*/
|
|
function setChildrenLayout(){
|
|
// lays out children for horizontal or vertical modes
|
|
if( (options.mode == 'horizontal' || options.mode == 'vertical') && options.infiniteLoop) {
|
|
// get the children behind
|
|
var $prependedChildren = getArraySample($children, 0, options.moveSlideQty, 'backward');
|
|
|
|
// add each prepended child to the back of the original element
|
|
$.each($prependedChildren, function(index) {
|
|
$parent.prepend($(this));
|
|
});
|
|
|
|
// total number of slides to be hidden after the window
|
|
var totalNumberAfterWindow = ($children.length + options.moveSlideQty) - 1;
|
|
// number of original slides hidden after the window
|
|
var pagerExcess = $children.length - options.displaySlideQty;
|
|
//var pagerExcess = $children.length - 4;
|
|
// number of slides to append to the original hidden slides
|
|
var numberToAppend = totalNumberAfterWindow - pagerExcess;
|
|
// get the sample of extra slides to append
|
|
var $appendedChildren = getArraySample($children, 0, numberToAppend, 'forward');
|
|
|
|
if(options.infiniteLoop){
|
|
// add each appended child to the front of the original element
|
|
$.each($appendedChildren, function(index) {
|
|
$parent.append($(this));
|
|
});
|
|
}
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Sets all variables associated with the controls
|
|
*/
|
|
function setControlsVars(){
|
|
// check if text or images should be used for controls
|
|
// check "next"
|
|
if(options.nextImage != ''){
|
|
nextContent = options.nextImage;
|
|
nextType = 'image';
|
|
}else{
|
|
nextContent = options.nextText;
|
|
nextType = 'text';
|
|
}
|
|
// check "prev"
|
|
if(options.prevImage != ''){
|
|
prevContent = options.prevImage;
|
|
prevType = 'image';
|
|
}else{
|
|
prevContent = options.prevText;
|
|
prevType = 'text';
|
|
}
|
|
// show the controls
|
|
showControls(nextType, nextContent, prevType, prevContent);
|
|
}
|
|
|
|
/**
|
|
* Puts slideshow into auto mode
|
|
*
|
|
* @param int pause number of ms the slideshow will wait between slides
|
|
* @param string direction 'forward', 'backward' sets the direction of the slideshow (forward/backward)
|
|
* @param bool controls determines if start/stop controls will be displayed
|
|
*/
|
|
function setAutoInterval(){
|
|
if(options.auto){
|
|
clearInterval(interval); // clear any existing interval
|
|
|
|
// finite loop
|
|
if(!options.infiniteLoop){
|
|
if(options.autoDirection == 'next'){
|
|
interval = setInterval(function(){
|
|
currentSlide += options.moveSlideQty;
|
|
// if currentSlide has exceeded total number
|
|
if(currentSlide > lastSlide){
|
|
currentSlide = currentSlide % $children.length;
|
|
}
|
|
base.goToSlide(currentSlide, false);
|
|
}, options.pause);
|
|
}else if(options.autoDirection == 'prev'){
|
|
interval = setInterval(function(){
|
|
currentSlide -= options.moveSlideQty;
|
|
// if currentSlide is smaller than zero
|
|
if(currentSlide < 0){
|
|
negativeOffset = (currentSlide % $children.length);
|
|
if(negativeOffset == 0){
|
|
currentSlide = 0;
|
|
}else{
|
|
currentSlide = ($children.length) + negativeOffset;
|
|
}
|
|
}
|
|
base.goToSlide(currentSlide, false);
|
|
}, options.pause);
|
|
}
|
|
// infinite loop
|
|
}else{
|
|
if(options.autoDirection == 'next'){
|
|
interval = setInterval(function(){
|
|
base.goToNextSlide(false);
|
|
}, options.pause);
|
|
}else if(options.autoDirection == 'prev'){
|
|
interval = setInterval(function(){
|
|
base.goToPreviousSlide(false);
|
|
}, options.pause);
|
|
}
|
|
}
|
|
|
|
}else if(options.ticker){
|
|
|
|
options.tickerSpeed *= 10;
|
|
|
|
// get the total width of the original show
|
|
$('.bx-child', $outerWrapper).each(function(index) {
|
|
origShowWidth += $(this).width();
|
|
origShowHeight += $(this).height();
|
|
});
|
|
|
|
// if prev start the show from the last slide
|
|
if(options.tickerDirection == 'prev' && options.mode == 'horizontal'){
|
|
$parent.css('left', '-'+(origShowWidth+origLeft)+'px');
|
|
}else if(options.tickerDirection == 'prev' && options.mode == 'vertical'){
|
|
$parent.css('top', '-'+(origShowHeight+origTop)+'px');
|
|
}
|
|
|
|
if(options.mode == 'horizontal'){
|
|
// get the starting left position
|
|
tickerLeft = parseInt($parent.css('left'));
|
|
// start the ticker
|
|
moveTheShow(tickerLeft, origShowWidth, options.tickerSpeed);
|
|
}else if(options.mode == 'vertical'){
|
|
// get the starting top position
|
|
tickerTop = parseInt($parent.css('top'));
|
|
// start the ticker
|
|
moveTheShow(tickerTop, origShowHeight, options.tickerSpeed);
|
|
}
|
|
|
|
// check it tickerHover applies
|
|
if(options.tickerHover){
|
|
setTickerHover();
|
|
}
|
|
}
|
|
}
|
|
|
|
function moveTheShow(leftCss, distance, speed){
|
|
// if horizontal
|
|
if(options.mode == 'horizontal'){
|
|
// if next
|
|
if(options.tickerDirection == 'next'){
|
|
$parent.animate({'left': '-='+distance+'px'}, speed, 'linear', function(){
|
|
$parent.css('left', leftCss);
|
|
moveTheShow(leftCss, origShowWidth, options.tickerSpeed);
|
|
});
|
|
// if prev
|
|
}else if(options.tickerDirection == 'prev'){
|
|
$parent.animate({'left': '+='+distance+'px'}, speed, 'linear', function(){
|
|
$parent.css('left', leftCss);
|
|
moveTheShow(leftCss, origShowWidth, options.tickerSpeed);
|
|
});
|
|
}
|
|
// if vertical
|
|
}else if(options.mode == 'vertical'){
|
|
// if next
|
|
if(options.tickerDirection == 'next'){
|
|
$parent.animate({'top': '-='+distance+'px'}, speed, 'linear', function(){
|
|
$parent.css('top', leftCss);
|
|
moveTheShow(leftCss, origShowHeight, options.tickerSpeed);
|
|
});
|
|
// if prev
|
|
}else if(options.tickerDirection == 'prev'){
|
|
$parent.animate({'top': '+='+distance+'px'}, speed, 'linear', function(){
|
|
$parent.css('top', leftCss);
|
|
moveTheShow(leftCss, origShowHeight, options.tickerSpeed);
|
|
});
|
|
}
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Sets all variables associated with the controls
|
|
*/
|
|
function setAutoControlsVars(){
|
|
// check if text or images should be used for controls
|
|
// check "start"
|
|
if(options.startImage != ''){
|
|
startContent = options.startImage;
|
|
startType = 'image';
|
|
}else{
|
|
startContent = options.startText;
|
|
startType = 'text';
|
|
}
|
|
// check "stop"
|
|
if(options.stopImage != ''){
|
|
stopContent = options.stopImage;
|
|
stopType = 'image';
|
|
}else{
|
|
stopContent = options.stopText;
|
|
stopType = 'text';
|
|
}
|
|
// show the controls
|
|
showAutoControls(startType, startContent, stopType, stopContent);
|
|
}
|
|
|
|
/**
|
|
* Handles hover events for auto shows
|
|
*/
|
|
function setAutoHover(){
|
|
// hover over the slider window
|
|
$outerWrapper.children('.bx-window').hover(function() {
|
|
if(autoPlaying){
|
|
base.suspendShow(false);
|
|
}
|
|
}, function() {
|
|
if(autoPlaying){
|
|
base.restartShow(false);
|
|
}
|
|
});
|
|
}
|
|
|
|
/**
|
|
* Handles hover events for ticker mode
|
|
*/
|
|
function setTickerHover(){
|
|
// on hover stop the animation
|
|
$parent.hover(function() {
|
|
if(autoPlaying){
|
|
base.stopTicker(false);
|
|
}
|
|
}, function() {
|
|
if(autoPlaying){
|
|
base.startTicker(false);
|
|
}
|
|
});
|
|
}
|
|
|
|
/**
|
|
* Handles fade animation
|
|
*/
|
|
function setChildrenFade(){
|
|
// fade out any other child besides the current
|
|
$children.not(':eq('+currentSlide+')').fadeTo(options.speed, 0).css('zIndex', 98);
|
|
// fade in the current slide
|
|
$children.eq(currentSlide).css('zIndex', 99).fadeTo(options.speed, 1, function(){
|
|
isWorking = false;
|
|
// ie fade fix
|
|
if(jQuery.browser.msie){
|
|
$children.eq(currentSlide).get(0).style.removeAttribute('filter');
|
|
}
|
|
// perform the callback function
|
|
options.onAfterSlide(currentSlide, $children.length, $children.eq(currentSlide));
|
|
});
|
|
};
|
|
|
|
/**
|
|
* Makes slide active
|
|
*/
|
|
function makeSlideActive(number){
|
|
if(options.pagerType == 'full' && options.pager){
|
|
// remove all active classes
|
|
$('a', $pager).removeClass(options.pagerActiveClass);
|
|
// assign active class to appropriate slide
|
|
$('a', $pager).eq(number).addClass(options.pagerActiveClass);
|
|
}else if(options.pagerType == 'short' && options.pager){
|
|
$('.bx-pager-current', $pager).html(currentSlide+1);
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Displays next/prev controls
|
|
*
|
|
* @param string nextType 'image', 'text'
|
|
* @param string nextContent if type='image', specify a filepath to the image. if type='text', specify text.
|
|
* @param string prevType 'image', 'text'
|
|
* @param string prevContent if type='image', specify a filepath to the image. if type='text', specify text.
|
|
*/
|
|
function showControls(nextType, nextContent, prevType, prevContent){
|
|
// create pager html elements
|
|
var $nextHtml = $('<a href="" class="next"></a>');
|
|
var $prevHtml = $('<a href="" class="prev"></a>');
|
|
|
|
$("<span class='a-l-s'>‹</span><span class='a-r-s'>‹</span>").appendTo($nextHtml);
|
|
$("<span class='a-l-s'> ›</span><span class='a-r-s'> ›</span>").appendTo($prevHtml);
|
|
// check if next is 'text' or 'image'
|
|
|
|
|
|
if(nextType == 'text'){
|
|
//$nextHtml.html(nextContent);
|
|
}else{
|
|
// $nextHtml.html('<img src="'+nextContent+'" />');
|
|
}
|
|
// check if prev is 'text' or 'image'
|
|
if(prevType == 'text'){
|
|
//$prevHtml.html(prevContent);
|
|
}else{
|
|
//$prevHtml.html('<img src="'+prevContent+'" />');
|
|
}
|
|
// check if user supplied a selector to populate next control
|
|
if(options.prevSelector){
|
|
$(options.prevSelector).append($prevHtml);
|
|
}else{
|
|
$outerWrapper.append($prevHtml);
|
|
}
|
|
// check if user supplied a selector to populate next control
|
|
if(options.nextSelector){
|
|
$(options.nextSelector).append($nextHtml);
|
|
}else{
|
|
$outerWrapper.append($nextHtml);
|
|
}
|
|
// click next control
|
|
$nextHtml.click(function() {
|
|
base.goToNextSlide();
|
|
return false;
|
|
});
|
|
// click prev control
|
|
$prevHtml.click(function() {
|
|
base.goToPreviousSlide();
|
|
return false;
|
|
});
|
|
$($prevHtml).not('.no-act').hover(function(){
|
|
$(this).find('span.a-l-s').animate({
|
|
left: "4px"
|
|
},{queue:false,duration:200});
|
|
|
|
$(this).find('span.a-r-s').fadeIn('fast').animate({
|
|
left: "0px"
|
|
},{queue:false,duration:200});
|
|
|
|
|
|
}, function(){
|
|
$(this).find('span.a-l-s').animate({
|
|
left: "2px"
|
|
},{queue:false,duration:200});
|
|
$(this).find('span.a-r-s').fadeOut('fast').animate({
|
|
left: "2px"
|
|
},{queue:false,duration:200});
|
|
});
|
|
|
|
$($nextHtml).not('.no-act').hover(function(){
|
|
$(this).find('span.a-l-s').animate({
|
|
left: "0px"
|
|
},{queue:false,duration:200});
|
|
$(this).find('span.a-r-s').fadeIn('fast').animate({
|
|
left: "4px"
|
|
},{queue:false,duration:200});
|
|
|
|
}, function(){
|
|
$(this).find('span.a-l-s').animate({
|
|
left: "2px"
|
|
},{queue:false,duration:200});
|
|
|
|
$(this).find('span.a-r-s').fadeOut('fast').animate({
|
|
left: "2px"
|
|
},{queue:false,duration:200});
|
|
|
|
});
|
|
}
|
|
base.each(function(){
|
|
$(this).touchwipe({
|
|
wipeLeft: function() { base.goToNextSlide(); },
|
|
wipeRight: function() { base.goToPreviousSlide() },
|
|
min_move_x: 30,
|
|
min_move_y: 20,
|
|
preventDefaultEvents: false,
|
|
dtPreventX: true
|
|
});
|
|
});
|
|
|
|
/**
|
|
* Displays the pager
|
|
*
|
|
* @param string type 'full', 'short'
|
|
*/
|
|
function showPager(type){
|
|
// sets up logic for finite multi slide shows
|
|
var pagerQty = $children.length;
|
|
// if we are moving more than one at a time and we have a finite loop
|
|
if(options.moveSlideQty > 1){
|
|
// if slides create an odd number of pages
|
|
if($children.length % options.moveSlideQty != 0){
|
|
// pagerQty = $children.length / options.moveSlideQty + 1;
|
|
pagerQty = Math.ceil($children.length / options.moveSlideQty);
|
|
// if slides create an even number of pages
|
|
}else{
|
|
pagerQty = $children.length / options.moveSlideQty;
|
|
}
|
|
}
|
|
var pagerString = '';
|
|
// check if custom build function was supplied
|
|
if(options.buildPager){
|
|
for(var i=0; i<pagerQty; i++){
|
|
pagerString += options.buildPager(i, $children.eq(i * options.moveSlideQty));
|
|
}
|
|
|
|
// if not, use default pager
|
|
}else if(type == 'full'){
|
|
// build the full pager
|
|
for(var i=1; i<=pagerQty; i++){
|
|
pagerString += '<a href="" class="pager-link pager-'+i+'">'+i+'</a>';
|
|
}
|
|
}else if(type == 'short') {
|
|
// build the short pager
|
|
pagerString = '<span class="bx-pager-current">'+(options.startingSlide+1)+'</span> '+options.pagerShortSeparator+' <span class="bx-pager-total">'+$children.length+'</span>';
|
|
}
|
|
// check if user supplied a pager selector
|
|
if(options.pagerSelector){
|
|
$(options.pagerSelector).append(pagerString);
|
|
$pager = $(options.pagerSelector);
|
|
}else{
|
|
var $pagerContainer = $('<div class="bx-pager"></div>');
|
|
$pagerContainer.append(pagerString);
|
|
// attach the pager to the DOM
|
|
if(options.pagerLocation == 'top'){
|
|
$outerWrapper.prepend($pagerContainer);
|
|
}else if(options.pagerLocation == 'bottom'){
|
|
$outerWrapper.append($pagerContainer);
|
|
}
|
|
// cache the pager element
|
|
$pager = $outerWrapper.children('.bx-pager');
|
|
}
|
|
$pager.children().click(function() {
|
|
// only if pager is full mode
|
|
if(options.pagerType == 'full'){
|
|
// get the index from the link
|
|
var slideIndex = $pager.children().index(this);
|
|
// accomodate moving more than one slide
|
|
if(options.moveSlideQty > 1){
|
|
slideIndex *= options.moveSlideQty;
|
|
}
|
|
base.goToSlide(slideIndex);
|
|
}
|
|
return false;
|
|
});
|
|
}
|
|
|
|
/**
|
|
* Displays captions
|
|
*/
|
|
function showCaptions(){
|
|
// get the title from each image
|
|
var caption = $('img', $children.eq(currentSlide)).attr('title');
|
|
// if the caption exists
|
|
if(caption != ''){
|
|
// if user supplied a selector
|
|
if(options.captionsSelector){
|
|
$(options.captionsSelector).html(caption);
|
|
}else{
|
|
$outerWrapper.children('.bx-captions').html(caption);
|
|
}
|
|
}else{
|
|
// if user supplied a selector
|
|
if(options.captionsSelector){
|
|
$(options.captionsSelector).html(' ');
|
|
}else{
|
|
$outerWrapper.children('.bx-captions').html(' ');
|
|
}
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Displays start/stop controls for auto and ticker mode
|
|
*
|
|
* @param string type 'image', 'text'
|
|
* @param string next [optional] if type='image', specify a filepath to the image. if type='text', specify text.
|
|
* @param string prev [optional] if type='image', specify a filepath to the image. if type='text', specify text.
|
|
*/
|
|
function showAutoControls(startType, startContent, stopType, stopContent){
|
|
// create pager html elements
|
|
$autoControls = $('<a href="" class="bx-start"></a>');
|
|
// check if start is 'text' or 'image'
|
|
if(startType == 'text'){
|
|
$startContent = startContent;
|
|
}else{
|
|
$startContent = '<img src="'+startContent+'" />';
|
|
}
|
|
// check if stop is 'text' or 'image'
|
|
if(stopType == 'text'){
|
|
$stopContent = stopContent;
|
|
}else{
|
|
$stopContent = '<img src="'+stopContent+'" />';
|
|
}
|
|
// check if user supplied a selector to populate next control
|
|
if(options.autoControlsSelector){
|
|
$(options.autoControlsSelector).append($autoControls);
|
|
}else{
|
|
$outerWrapper.append('<div class="bx-auto"></div>');
|
|
$outerWrapper.children('.bx-auto').html($autoControls);
|
|
}
|
|
|
|
// click start control
|
|
$autoControls.click(function() {
|
|
if(options.ticker){
|
|
if($(this).hasClass('stop')){
|
|
base.stopTicker();
|
|
}else if($(this).hasClass('start')){
|
|
base.startTicker();
|
|
}
|
|
}else{
|
|
if($(this).hasClass('stop')){
|
|
base.stopShow(true);
|
|
}else if($(this).hasClass('start')){
|
|
base.startShow(true);
|
|
}
|
|
}
|
|
return false;
|
|
});
|
|
|
|
}
|
|
|
|
/**
|
|
* Checks if show is in finite mode, and if slide is either first or last, then hides the respective control
|
|
*/
|
|
function checkEndControls(){
|
|
if(!options.infiniteLoop && options.hideControlOnEnd){
|
|
// check previous
|
|
if(currentSlide == firstSlide){
|
|
$outerWrapper.children('.prev').hide();
|
|
}else{
|
|
$outerWrapper.children('.prev').show();
|
|
}
|
|
// check next
|
|
var lastPossibleSlide = Math.floor(lastSlide/options.displaySlideQty) * options.displaySlideQty;
|
|
if(currentSlide >= lastPossibleSlide){
|
|
|
|
$outerWrapper.children('.next').hide();
|
|
}else{
|
|
$outerWrapper.children('.next').show();
|
|
}
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Returns the left offset of the slide from the parent container
|
|
*/
|
|
function getSlidePosition(number, side){
|
|
var $slidePosition = $parent.find(' > .bx-child').eq(number).position();
|
|
return (side == 'left') ? $slidePosition.left : $slidePosition.top;
|
|
}
|
|
|
|
/**
|
|
* Returns the width of the wrapper
|
|
*/
|
|
function getWrapperWidth(){
|
|
var wrapperWidth = $firstChild.outerWidth() * options.displaySlideQty;
|
|
return wrapperWidth;
|
|
}
|
|
|
|
/**
|
|
* Returns the height of the wrapper
|
|
*/
|
|
function getWrapperHeight(){
|
|
// if displaying multiple slides, multiple wrapper width by number of slides to display
|
|
var wrapperHeight = $firstChild.outerHeight() * options.displaySlideQty;
|
|
return wrapperHeight;
|
|
}
|
|
|
|
/**
|
|
* Returns a sample of an arry and loops back on itself if the end of the array is reached
|
|
*
|
|
* @param array array original array the sample is derived from
|
|
* @param int start array index sample will start
|
|
* @param int length number of items in the sample
|
|
* @param string direction 'forward', 'backward' direction the loop should travel in the array
|
|
*/
|
|
|
|
|
|
function getArraySample(array, start, length, direction){
|
|
/* $children.length
|
|
window.par_width = base.parent().width(),
|
|
child_width = base.children().width(),
|
|
num_show = Math.round(par_width/child_width);
|
|
if(($children.length <= num_show)){
|
|
console.log('remove')
|
|
$parent.children(options.childSelector).not('.bx-child').remove();
|
|
}*/
|
|
//if( $children.length <= num_show ){
|
|
//}else{
|
|
// initialize empty array
|
|
var sample = [];
|
|
// clone the length argument
|
|
var loopLength = length;
|
|
// determines when the empty array should start being populated
|
|
var startPopulatingArray = false;
|
|
// reverse the array if direction = 'backward'
|
|
|
|
if(direction == 'backward'){
|
|
array = $.makeArray(array);
|
|
array.reverse();
|
|
}
|
|
//if(($children.length > num_show)){
|
|
// loop through original array until the length argument is met
|
|
while(loopLength > 0){
|
|
// loop through original array
|
|
$.each(array, function(index, val) {
|
|
// check if length has been met
|
|
if(loopLength > 0){
|
|
// don't do anything unless first index has been reached
|
|
if(!startPopulatingArray){
|
|
// start populating empty array
|
|
|
|
if(index == start){
|
|
startPopulatingArray = true;
|
|
|
|
// add element to array
|
|
sample.push($(this).clone(true).addClass('clones'))
|
|
//sample.find('img').parent();
|
|
$('.clones a.photo').each(function(){
|
|
var $span = $('i.fade', this);
|
|
|
|
|
|
|
|
if ($.browser.msie && $.browser.version < 9){
|
|
$span.hide();
|
|
} else {
|
|
$span.css('opacity', 0);
|
|
}
|
|
|
|
$(this).hover(function() {
|
|
if ($.browser.msie && $.browser.version < 9){
|
|
$span.show();
|
|
}
|
|
else{
|
|
$span.stop().fadeTo(700, 1);
|
|
}
|
|
}, function() {
|
|
if ($.browser.msie && $.browser.version < 9){
|
|
$span.hide();
|
|
} else {
|
|
$span.stop().fadeTo(700, 0);
|
|
}
|
|
});
|
|
})
|
|
|
|
// decrease the length clone variable
|
|
loopLength--;
|
|
|
|
}
|
|
}else{
|
|
|
|
|
|
// add element to array
|
|
sample.push($(this).clone(true).addClass('clones'));
|
|
|
|
$('.clones a.photo').each(function(){
|
|
var $span = $('i.fade', this);
|
|
if ($.browser.msie && $.browser.version < 9){
|
|
$span.hide();
|
|
} else {
|
|
$span.css('opacity', 0);
|
|
}
|
|
|
|
$(this).hover(function() {
|
|
|
|
var $span = $('i.fade', this);
|
|
if ($.browser.msie && $.browser.version < 9){
|
|
$span.show();
|
|
}
|
|
else{
|
|
$span.stop().fadeTo(700, 1);
|
|
}
|
|
}, function() {
|
|
|
|
var $span = $('i.fade', this);
|
|
if ($.browser.msie && $.browser.version < 9){
|
|
$span.hide();
|
|
} else {
|
|
$span.stop().fadeTo(700, 0);
|
|
}
|
|
});
|
|
})
|
|
|
|
//$(this).detach().appendTo(sample);
|
|
// decrease the length clone variable
|
|
loopLength--;
|
|
|
|
|
|
}
|
|
// if length has been met, break loose
|
|
}else{
|
|
return false;
|
|
}
|
|
});
|
|
}
|
|
return sample;
|
|
//}
|
|
//}
|
|
|
|
|
|
}
|
|
|
|
|
|
this.each(function(){
|
|
// make sure the element has children
|
|
if($(this).children().length > 0){
|
|
base.initShow();
|
|
|
|
}
|
|
});
|
|
|
|
return this;
|
|
|
|
|
|
}
|
|
|
|
jQuery.fx.prototype.cur = function(){
|
|
if ( this.elem[this.prop] != null && (!this.elem.style || this.elem.style[this.prop] == null) ) {
|
|
return this.elem[ this.prop ];
|
|
}
|
|
|
|
var r = parseFloat( jQuery.css( this.elem, this.prop ) );
|
|
// return r && r > -10000 ? r : 0;
|
|
return r;
|
|
}
|
|
|
|
|
|
})(jQuery);
|
|
|
|
/*********************************************************************************************************************************/
|
|
|
|
// JavaScript Document
|
|
/*global jQuery */
|
|
/*!
|
|
* FitVids 1.0
|
|
*
|
|
* Copyright 2011, Chris Coyier - http://css-tricks.com + Dave Rupert - http://daverupert.com
|
|
* Credit to Thierry Koblentz - http://www.alistapart.com/articles/creating-intrinsic-ratios-for-video/
|
|
* Released under the WTFPL license - http://sam.zoy.org/wtfpl/
|
|
*
|
|
* Date: Thu Sept 01 18:00:00 2011 -0500
|
|
*/
|
|
(function(a){a.fn.fitVids=function(b){var c={customSelector:null},d=document.createElement("div"),e=document.getElementsByTagName("base")[0]||document.getElementsByTagName("script")[0];return d.className="fit-vids-style",d.innerHTML="­<style> .fluid-width-video-wrapper { width: 100%; position: relative; padding: 0; } .fluid-width-video-wrapper iframe, .fluid-width-video-wrapper object, .fluid-width-video-wrapper embed { position: absolute; top: 0; left: 0; width: 100%; height: 100%; } </style>",e.parentNode.insertBefore(d,e),b&&a.extend(c,b),this.each(function(){var b=["iframe[src^='http://player.vimeo.com']","iframe[src^='http://www.youtube.com']","iframe[src^='https://www.youtube.com']","iframe[src^='http://www.kickstarter.com']","object","embed"];c.customSelector&&b.push(c.customSelector);var d=a(this).find(b.join(","));d.each(function(){var b=a(this);if(this.tagName.toLowerCase()=="embed"&&b.parent("object").length||b.parent(".fluid-width-video-wrapper").length)return;var c=this.tagName.toLowerCase()=="object"?b.attr("height"):b.height(),d=c/b.width();if(!b.attr("id")){var e="fitvid"+Math.floor(Math.random()*999999);b.attr("id",e)}b.wrap('<div class="fluid-width-video-wrapper"></div>').parent(".fluid-width-video-wrapper").css("padding-top",d*100+"%"),b.removeAttr("height").removeAttr("width")})})}})(jQuery)
|
|
|
|
/*
|
|
* jQuery FlexSlider v2.0
|
|
* http://www.woothemes.com/flexslider/
|
|
*
|
|
* Copyright 2012 WooThemes
|
|
* Free to use under the GPLv2 license.
|
|
* http://www.gnu.org/licenses/gpl-2.0.html
|
|
*
|
|
* Contributing author: Tyler Smith (@mbmufffin)
|
|
*/
|
|
|
|
jQuery(document).ready( function($) {
|
|
|
|
//FlexSlider: Object Instance
|
|
$.flexslider = function(el, options) {
|
|
var slider = $(el),
|
|
vars = $.extend({}, $.flexslider.defaults, options),
|
|
namespace = vars.namespace,
|
|
touch = ("ontouchstart" in window) || window.DocumentTouch && document instanceof DocumentTouch,
|
|
eventType = (touch) ? "touchend" : "click",
|
|
vertical = vars.direction === "vertical",
|
|
reverse = vars.reverse,
|
|
carousel = (vars.itemWidth > 0),
|
|
fade = vars.animation === "fade",
|
|
asNav = vars.asNavFor !== "",
|
|
methods = {};
|
|
|
|
// Store a reference to the slider object
|
|
$.data(el, "flexslider", slider);
|
|
|
|
// Privat slider methods
|
|
methods = {
|
|
init: function() {
|
|
slider.animating = false;
|
|
slider.currentSlide = vars.startAt;
|
|
slider.animatingTo = slider.currentSlide;
|
|
slider.atEnd = (slider.currentSlide === 0 || slider.currentSlide === slider.last);
|
|
slider.containerSelector = vars.selector.substr(0,vars.selector.search(' '));
|
|
slider.slides = $(vars.selector, slider);
|
|
slider.container = $(slider.containerSelector, slider);
|
|
slider.count = slider.slides.length;
|
|
// SYNC:
|
|
slider.syncExists = $(vars.sync).length > 0;
|
|
// SLIDE:
|
|
if (vars.animation === "slide") vars.animation = "swing";
|
|
slider.prop = (vertical) ? "top" : "marginLeft";
|
|
slider.args = {};
|
|
// SLIDESHOW:
|
|
slider.manualPause = false;
|
|
// TOUCH/USECSS:
|
|
slider.transitions = !vars.video && !fade && vars.useCSS && (function() {
|
|
var obj = document.createElement('div'),
|
|
props = ['perspectiveProperty', 'WebkitPerspective', 'MozPerspective', 'OPerspective', 'msPerspective'];
|
|
for (var i in props) {
|
|
if ( obj.style[ props[i] ] !== undefined ) {
|
|
slider.pfx = props[i].replace('Perspective','').toLowerCase();
|
|
slider.prop = "-" + slider.pfx + "-transform";
|
|
return true;
|
|
}
|
|
}
|
|
return false;
|
|
}());
|
|
// CONTROLSCONTAINER:
|
|
if (vars.controlsContainer !== "") slider.controlsContainer = $(vars.controlsContainer).length > 0 && $(vars.controlsContainer);
|
|
// MANUAL:
|
|
if (vars.manualControls !== "") slider.manualControls = $(vars.manualControls).length > 0 && $(vars.manualControls);
|
|
|
|
// RANDOMIZE:
|
|
if (vars.randomize) {
|
|
slider.slides.sort(function() { return (Math.round(Math.random())-0.5); });
|
|
slider.container.empty().append(slider.slides);
|
|
}
|
|
|
|
slider.doMath();
|
|
|
|
// ASNAV:
|
|
if (asNav) methods.asNav.setup();
|
|
|
|
// INIT
|
|
slider.setup("init");
|
|
|
|
// CONTROLNAV:
|
|
if (vars.controlNav) methods.controlNav.setup();
|
|
|
|
// DIRECTIONNAV:
|
|
if (vars.directionNav) methods.directionNav.setup();
|
|
|
|
// KEYBOARD:
|
|
if (vars.keyboard && ($(slider.containerSelector).length === 1 || vars.multipleKeyboard)) {
|
|
$(document).bind('keyup', function(event) {
|
|
var keycode = event.keyCode;
|
|
if (!slider.animating && (keycode === 39 || keycode === 37)) {
|
|
var target = (keycode === 39) ? slider.getTarget('next') :
|
|
(keycode === 37) ? slider.getTarget('prev') : false;
|
|
slider.flexAnimate(target, vars.pauseOnAction);
|
|
}
|
|
});
|
|
}
|
|
// MOUSEWHEEL:
|
|
if (vars.mousewheel) {
|
|
slider.bind('mousewheel', function(event, delta, deltaX, deltaY) {
|
|
event.preventDefault();
|
|
var target = (delta < 0) ? slider.getTarget('next') : slider.getTarget('prev');
|
|
slider.flexAnimate(target, vars.pauseOnAction);
|
|
});
|
|
}
|
|
|
|
// PAUSEPLAY
|
|
if (vars.pausePlay) methods.pausePlay.setup();
|
|
|
|
// SLIDSESHOW
|
|
if (vars.slideshow) {
|
|
if (vars.pauseOnHover) {
|
|
slider.hover(function() {
|
|
slider.pause();
|
|
}, function() {
|
|
if (!slider.manualPause) slider.play();
|
|
});
|
|
}
|
|
// initialize animation
|
|
(vars.initDelay > 0) ? setTimeout(slider.play, vars.initDelay) : slider.play();
|
|
}
|
|
|
|
// TOUCH
|
|
if (touch && vars.touch) methods.touch();
|
|
|
|
// FADE&&SMOOTHHEIGHT || SLIDE:
|
|
if (!fade || (fade && vars.smoothHeight)) $(window).bind("resize focus", methods.resize);
|
|
|
|
|
|
// API: start() Callback
|
|
setTimeout(function(){
|
|
vars.start(slider);
|
|
}, 200);
|
|
},
|
|
asNav: {
|
|
setup: function() {
|
|
slider.asNav = true;
|
|
slider.animatingTo = Math.floor(slider.currentSlide/slider.move);
|
|
slider.currentItem = slider.currentSlide;
|
|
slider.slides.removeClass(namespace + "active-slide").eq(slider.currentItem).addClass(namespace + "active-slide");
|
|
|
|
|
|
slider.slides.click(function(e){
|
|
e.preventDefault();
|
|
var $slide = $(this),
|
|
target = $slide.index();
|
|
if (!$(vars.asNavFor).data('flexslider').animating && !$slide.hasClass('active')) {
|
|
slider.direction = (slider.currentItem < target) ? "next" : "prev";
|
|
slider.flexAnimate(target, vars.pauseOnAction, false, true, true);
|
|
}
|
|
});
|
|
}
|
|
},
|
|
controlNav: {
|
|
setup: function() {
|
|
if (!slider.manualControls) {
|
|
methods.controlNav.setupPaging();
|
|
} else { // MANUALCONTROLS:
|
|
methods.controlNav.setupManual();
|
|
}
|
|
},
|
|
setupPaging: function() {
|
|
var type = (vars.controlNav === "thumbnails") ? 'control-thumbs' : 'control-paging',
|
|
j = 1,
|
|
item;
|
|
|
|
slider.controlNavScaffold = $('<ol class="'+ namespace + 'control-nav ' + namespace + type + '"></ol>');
|
|
|
|
if (slider.pagingCount > 1) {
|
|
for (var i = 0; i < slider.pagingCount; i++) {
|
|
item = (vars.controlNav === "thumbnails") ? '<img src="' + slider.slides.eq(i).attr("data-thumb") + '"/>' : '<a>' + j + '</a>';
|
|
slider.controlNavScaffold.append('<li>' + item + '</li>');
|
|
j++;
|
|
}
|
|
}
|
|
|
|
// CONTROLSCONTAINER:
|
|
(slider.controlsContainer) ? $(slider.controlsContainer).append(slider.controlNavScaffold) : slider.append(slider.controlNavScaffold);
|
|
methods.controlNav.set();
|
|
|
|
methods.controlNav.active();
|
|
|
|
slider.controlNavScaffold.delegate('a, img', eventType, function(event) {
|
|
event.preventDefault();
|
|
var $this = $(this),
|
|
target = slider.controlNav.index($this);
|
|
|
|
if (!$this.hasClass(namespace + 'active')) {
|
|
slider.direction = (target > slider.currentSlide) ? "next" : "prev";
|
|
slider.flexAnimate(target, vars.pauseOnAction);
|
|
}
|
|
});
|
|
// Prevent iOS click event bug
|
|
if (touch) {
|
|
slider.controlNavScaffold.delegate('a', "click touchstart", function(event) {
|
|
event.preventDefault();
|
|
});
|
|
}
|
|
},
|
|
setupManual: function() {
|
|
slider.controlNav = slider.manualControls;
|
|
methods.controlNav.active();
|
|
|
|
slider.controlNav.live(eventType, function(event) {
|
|
event.preventDefault();
|
|
var $this = $(this),
|
|
target = slider.controlNav.index($this);
|
|
|
|
if (!$this.hasClass(namespace + 'active')) {
|
|
(target > slider.currentSlide) ? slider.direction = "next" : slider.direction = "prev";
|
|
slider.flexAnimate(target, vars.pauseOnAction);
|
|
}
|
|
});
|
|
// Prevent iOS click event bug
|
|
if (touch) {
|
|
slider.controlNav.live("click touchstart", function(event) {
|
|
event.preventDefault();
|
|
});
|
|
}
|
|
},
|
|
set: function() {
|
|
var selector = (vars.controlNav === "thumbnails") ? 'img' : 'a';
|
|
slider.controlNav = $('.' + namespace + 'control-nav li ' + selector, (slider.controlsContainer) ? slider.controlsContainer : slider);
|
|
},
|
|
active: function() {
|
|
slider.controlNav.removeClass(namespace + "active").eq(slider.animatingTo).addClass(namespace + "active");
|
|
},
|
|
update: function(action, pos) {
|
|
if (slider.pagingCount > 1 && action === "add") {
|
|
slider.controlNavScaffold.append($('<li><a>' + slider.count + '</a></li>'));
|
|
} else if (slider.pagingCount === 1) {
|
|
slider.controlNavScaffold.find('li').remove();
|
|
} else {
|
|
slider.controlNav.eq(pos).closest('li').remove();
|
|
}
|
|
methods.controlNav.set();
|
|
(slider.pagingCount > 1 && slider.pagingCount !== slider.controlNav.length) ? slider.update(pos, action) : methods.controlNav.active();
|
|
}
|
|
},
|
|
directionNav: {
|
|
setup: function() {
|
|
var directionNavScaffold = $('<ul class="' + namespace + 'direction-nav"><li class="prev-fl"><a class="' + namespace + 'prev" href="#"><span class="a-l">‹</span><span class="a-r">‹</span></a></li><li class="next-fl"><a class="' + namespace + 'next" href="#"><span class="a-l">›</span><span class="a-r">›</span></a></li></ul>');
|
|
|
|
|
|
|
|
hoverArrows()
|
|
|
|
// CONTROLSCONTAINER:
|
|
if (slider.controlsContainer) {
|
|
$(slider.controlsContainer).append(directionNavScaffold);
|
|
slider.directionNav = $('.' + namespace + 'direction-nav li a', slider.controlsContainer);
|
|
} else {
|
|
slider.append(directionNavScaffold);
|
|
slider.directionNav = $('.' + namespace + 'direction-nav li a', slider);
|
|
}
|
|
|
|
methods.directionNav.update();
|
|
|
|
slider.directionNav.bind(eventType, function(event) {
|
|
event.preventDefault();
|
|
var target = ($(this).hasClass(namespace + 'next')) ? slider.getTarget('next') : slider.getTarget('prev');
|
|
slider.flexAnimate(target, vars.pauseOnAction);
|
|
|
|
|
|
});
|
|
// Prevent iOS click event bug
|
|
if (touch) {
|
|
slider.directionNav.bind("click touchstart", function(event) {
|
|
event.preventDefault();
|
|
});
|
|
}
|
|
},
|
|
update: function() {
|
|
var disabledClass = namespace + 'disabled';
|
|
if (!vars.animationLoop) {
|
|
if (slider.pagingCount === 1) {
|
|
slider.directionNav.addClass(disabledClass);
|
|
} else if (slider.animatingTo === 0) {
|
|
slider.directionNav.removeClass(disabledClass).filter('.' + namespace + "prev").addClass(disabledClass);
|
|
} else if (slider.animatingTo === slider.last) {
|
|
slider.directionNav.removeClass(disabledClass).filter('.' + namespace + "next").addClass(disabledClass);
|
|
} else {
|
|
slider.directionNav.removeClass(disabledClass);
|
|
}
|
|
}
|
|
}
|
|
},
|
|
pausePlay: {
|
|
setup: function() {
|
|
var pausePlayScaffold = $('<div class="' + namespace + 'pauseplay"><a></a></div>');
|
|
|
|
// CONTROLSCONTAINER:
|
|
if (slider.controlsContainer) {
|
|
slider.controlsContainer.append(pausePlayScaffold);
|
|
slider.pausePlay = $('.' + namespace + 'pauseplay a', slider.controlsContainer);
|
|
} else {
|
|
slider.append(pausePlayScaffold);
|
|
slider.pausePlay = $('.' + namespace + 'pauseplay a', slider);
|
|
}
|
|
|
|
// slider.pausePlay.addClass(pausePlayState).text((pausePlayState == 'pause') ? vars.pauseText : vars.playText);
|
|
methods.pausePlay.update((vars.slideshow) ? namespace + 'pause' : namespace + 'play');
|
|
|
|
slider.pausePlay.bind(eventType, function(event) {
|
|
event.preventDefault();
|
|
if ($(this).hasClass(namespace + 'pause')) {
|
|
slider.pause();
|
|
slider.manualPause = true;
|
|
} else {
|
|
slider.play();
|
|
slider.manualPause = false;
|
|
}
|
|
});
|
|
// Prevent iOS click event bug
|
|
if (touch) {
|
|
slider.pausePlay.bind("click touchstart", function(event) {
|
|
event.preventDefault();
|
|
});
|
|
}
|
|
},
|
|
update: function(state) {
|
|
(state === "play") ? slider.pausePlay.removeClass(namespace + 'pause').addClass(namespace + 'play').text(vars.playText) : slider.pausePlay.removeClass(namespace + 'play').addClass(namespace + 'pause').text(vars.pauseText);
|
|
}
|
|
},
|
|
touch: function() {
|
|
var startX,
|
|
startY,
|
|
offset,
|
|
cwidth,
|
|
dx,
|
|
startT,
|
|
scrolling = false;
|
|
|
|
el.addEventListener('touchstart', onTouchStart, false);
|
|
function onTouchStart(e) {
|
|
if (slider.animating) {
|
|
e.preventDefault();
|
|
} else if (e.touches.length === 1) {
|
|
slider.pause();
|
|
// CAROUSEL:
|
|
cwidth = (vertical) ? slider.h : slider. w;
|
|
startT = Number(new Date());
|
|
// CAROUSEL:
|
|
offset = (carousel && reverse && slider.animatingTo === slider.last) ? 0 :
|
|
(carousel && reverse) ? slider.limit - (((slider.itemW + vars.itemMargin) * slider.move) * slider.animatingTo) :
|
|
(carousel && slider.currentSlide === slider.last) ? slider.limit :
|
|
(carousel) ? ((slider.itemW + vars.itemMargin) * slider.move) * slider.currentSlide :
|
|
(reverse) ? (slider.last - slider.currentSlide + slider.cloneOffset) * cwidth : (slider.currentSlide + slider.cloneOffset) * cwidth;
|
|
startX = (vertical) ? e.touches[0].pageY : e.touches[0].pageX;
|
|
startY = (vertical) ? e.touches[0].pageX : e.touches[0].pageY;
|
|
|
|
el.addEventListener('touchmove', onTouchMove, false);
|
|
el.addEventListener('touchend', onTouchEnd, false);
|
|
}
|
|
}
|
|
|
|
function onTouchMove(e) {
|
|
dx = (vertical) ? startX - e.touches[0].pageY : startX - e.touches[0].pageX;
|
|
scrolling = (vertical) ? (Math.abs(dx) < Math.abs(e.touches[0].pageX - startY)) : (Math.abs(dx) < Math.abs(e.touches[0].pageY - startY));
|
|
|
|
if (!scrolling || Number(new Date()) - startT > 500) {
|
|
e.preventDefault();
|
|
if (!fade && slider.transitions) {
|
|
if (!vars.animationLoop) {
|
|
dx = dx/((slider.currentSlide === 0 && dx < 0 || slider.currentSlide === slider.last && dx > 0) ? (Math.abs(dx)/cwidth+2) : 1);
|
|
}
|
|
slider.setProps(offset + dx, "setTouch");
|
|
}
|
|
}
|
|
}
|
|
|
|
function onTouchEnd(e) {
|
|
if (slider.animatingTo === slider.currentSlide && !scrolling && !(dx === null)) {
|
|
var updateDx = (reverse) ? -dx : dx,
|
|
target = (updateDx > 0) ? slider.getTarget('next') : slider.getTarget('prev');
|
|
|
|
if (slider.canAdvance(target) && (Number(new Date()) - startT < 550 && Math.abs(updateDx) > 20 || Math.abs(updateDx) > cwidth/2)) {
|
|
slider.flexAnimate(target, vars.pauseOnAction);
|
|
} else {
|
|
slider.flexAnimate(slider.currentSlide, vars.pauseOnAction, true);
|
|
}
|
|
}
|
|
// finish the touch by undoing the touch session
|
|
el.removeEventListener('touchmove', onTouchMove, false);
|
|
el.removeEventListener('touchend', onTouchEnd, false);
|
|
startX = null;
|
|
startY = null;
|
|
dx = null;
|
|
offset = null;
|
|
}
|
|
},
|
|
resize: function() {
|
|
if (!slider.animating && slider.is(':visible')) {
|
|
if (!carousel) slider.doMath();
|
|
|
|
if (fade) {
|
|
// SMOOTH HEIGHT:
|
|
methods.smoothHeight();
|
|
} else if (carousel) { //CAROUSEL:
|
|
slider.slides.width(slider.computedW);
|
|
slider.update(slider.pagingCount);
|
|
slider.setProps();
|
|
}
|
|
else if (vertical) { //VERTICAL:
|
|
slider.viewport.height(slider.h);
|
|
slider.setProps(slider.h, "setTotal");
|
|
} else {
|
|
// SMOOTH HEIGHT:
|
|
if (vars.smoothHeight) methods.smoothHeight();
|
|
slider.newSlides.width(slider.computedW);
|
|
slider.setProps(slider.computedW, "setTotal");
|
|
}
|
|
}
|
|
},
|
|
smoothHeight: function(dur) {
|
|
if (!vertical || fade) {
|
|
var $obj = (fade) ? slider : slider.viewport;
|
|
(dur) ? $obj.animate({"height": slider.slides.eq(slider.animatingTo).height()}, dur) : $obj.height(slider.slides.eq(slider.animatingTo).height());
|
|
}
|
|
},
|
|
sync: function(action) {
|
|
var $obj = $(vars.sync).data("flexslider"),
|
|
target = slider.animatingTo;
|
|
|
|
switch (action) {
|
|
case "animate": $obj.flexAnimate(target, vars.pauseOnAction, false, true); break;
|
|
case "play": if (!$obj.playing && !$obj.asNav) { $obj.play(); } break;
|
|
case "pause": $obj.pause(); break;
|
|
}
|
|
}
|
|
}
|
|
|
|
// public methods
|
|
slider.flexAnimate = function(target, pause, override, withSync, fromNav) {
|
|
if (!slider.animating && (slider.canAdvance(target) || override) && slider.is(":visible")) {
|
|
if (asNav && withSync) {
|
|
var master = $(vars.asNavFor).data('flexslider');
|
|
slider.atEnd = target === 0 || target === slider.count - 1;
|
|
master.flexAnimate(target, true, false, true, fromNav);
|
|
slider.direction = (slider.currentItem < target) ? "next" : "prev";
|
|
master.direction = slider.direction;
|
|
|
|
if (Math.ceil((target + 1)/slider.visible) - 1 !== slider.currentSlide && target !== 0) {
|
|
slider.currentItem = target;
|
|
slider.slides.removeClass(namespace + "active-slide").eq(target).addClass(namespace + "active-slide");
|
|
|
|
|
|
target = Math.floor(target/slider.visible);
|
|
} else {
|
|
slider.currentItem = target;
|
|
slider.slides.removeClass(namespace + "active-slide").eq(target).addClass(namespace + "active-slide");
|
|
|
|
|
|
return false;
|
|
}
|
|
}
|
|
|
|
slider.animating = true;
|
|
slider.animatingTo = target;
|
|
// API: before() animation Callback
|
|
vars.before(slider);
|
|
|
|
// SLIDESHOW:
|
|
if (pause) slider.pause();
|
|
|
|
// SYNC:
|
|
if (slider.syncExists && !fromNav) methods.sync("animate");
|
|
|
|
// CONTROLNAV
|
|
if (vars.controlNav) methods.controlNav.active();
|
|
|
|
// !CAROUSEL:
|
|
// CANDIDATE: slide active class (for add/remove slide)
|
|
if (!carousel) slider.slides.removeClass(namespace + 'active-slide').eq(target).addClass(namespace + 'active-slide');
|
|
var $_currentPage = slider.slides.eq(target);
|
|
if($_currentPage.find('iframe').length > 0) {
|
|
$('.flexslider ').addClass('anything-video');
|
|
|
|
if ( $.browser.msie && $.browser.version < 8 ){
|
|
}
|
|
$('iframe', $_currentPage).css({
|
|
'visibility':'visible'
|
|
})
|
|
|
|
}
|
|
else {
|
|
$('.flexslider ').removeClass('anything-video');
|
|
$('.flexslider iframe').css({
|
|
'visibility':'hidden'
|
|
})
|
|
|
|
}
|
|
|
|
// INFINITE LOOP:
|
|
// CANDIDATE: atEnd
|
|
slider.atEnd = target === 0 || target === slider.last;
|
|
|
|
// DIRECTIONNAV:
|
|
if (vars.directionNav) methods.directionNav.update();
|
|
|
|
if (target === slider.last) {
|
|
// API: end() of cycle Callback
|
|
vars.end(slider);
|
|
// SLIDESHOW && !INFINITE LOOP:
|
|
if (!vars.animationLoop) slider.pause();
|
|
}
|
|
|
|
// SLIDE:
|
|
if (!fade) {
|
|
var dimension = (vertical) ? slider.slides.filter(':first').height() : slider.computedW,
|
|
margin, slideString, calcNext;
|
|
|
|
// INFINITE LOOP / REVERSE:
|
|
if (carousel) {
|
|
margin = (vars.itemWidth > slider.w) ? vars.itemMargin * 2 : vars.itemMargin;
|
|
calcNext = ((slider.itemW + margin) * slider.move) * slider.animatingTo;
|
|
slideString = (calcNext > slider.limit && slider.visible !== 1) ? slider.limit : calcNext;
|
|
} else if (slider.currentSlide === 0 && target === slider.count - 1 && vars.animationLoop && slider.direction !== "next") {
|
|
slideString = (reverse) ? (slider.count + slider.cloneOffset) * dimension : 0;
|
|
} else if (slider.currentSlide === slider.last && target === 0 && vars.animationLoop && slider.direction !== "prev") {
|
|
slideString = (reverse) ? 0 : (slider.count + 1) * dimension;
|
|
} else {
|
|
slideString = (reverse) ? ((slider.count - 1) - target + slider.cloneOffset) * dimension : (target + slider.cloneOffset) * dimension;
|
|
}
|
|
slider.setProps(slideString, "", vars.animationSpeed);
|
|
if (slider.transitions) {
|
|
if (!vars.animationLoop || !slider.atEnd) {
|
|
slider.animating = false;
|
|
slider.currentSlide = slider.animatingTo;
|
|
}
|
|
slider.container.unbind("webkitTransitionEnd transitionend");
|
|
slider.container.bind("webkitTransitionEnd transitionend", function() {
|
|
slider.wrapup(dimension);
|
|
});
|
|
} else {
|
|
slider.container.animate(slider.args, vars.animationSpeed, vars.easing, function(){
|
|
slider.wrapup(dimension);
|
|
});
|
|
}
|
|
} else { // FADE:
|
|
var parrent_this = slider;
|
|
slider.slides.eq(slider.currentSlide).fadeOut(vars.animationSpeed, vars.easing, function(){
|
|
|
|
|
|
});
|
|
slider.slides.eq(target).fadeIn(vars.animationSpeed, vars.easing, slider.wrapup, function(){
|
|
|
|
|
|
});
|
|
}
|
|
// SMOOTH HEIGHT:
|
|
if (vars.smoothHeight) methods.smoothHeight(vars.animationSpeed);
|
|
}
|
|
}
|
|
slider.wrapup = function(dimension) {
|
|
// SLIDE:
|
|
if (!fade && !carousel) {
|
|
if (slider.currentSlide === 0 && slider.animatingTo === slider.last && vars.animationLoop) {
|
|
slider.setProps(dimension, "jumpEnd");
|
|
} else if (slider.currentSlide === slider.last && slider.animatingTo === 0 && vars.animationLoop) {
|
|
slider.setProps(dimension, "jumpStart");
|
|
}
|
|
}
|
|
slider.animating = false;
|
|
slider.currentSlide = slider.animatingTo;
|
|
// API: after() animation Callback
|
|
vars.after(slider);
|
|
}
|
|
|
|
// SLIDESHOW:
|
|
slider.animateSlides = function() {
|
|
if (!slider.animating) slider.flexAnimate(slider.getTarget("next"));
|
|
}
|
|
// SLIDESHOW:
|
|
slider.pause = function() {
|
|
clearInterval(slider.animatedSlides);
|
|
slider.playing = false;
|
|
// PAUSEPLAY:
|
|
if (vars.pausePlay) methods.pausePlay.update("play");
|
|
// SYNC:
|
|
if (slider.syncExists) methods.sync("pause");
|
|
}
|
|
// SLIDESHOW:
|
|
slider.play = function() {
|
|
slider.animatedSlides = setInterval(slider.animateSlides, vars.slideshowSpeed);
|
|
slider.playing = true;
|
|
// PAUSEPLAY:
|
|
if (vars.pausePlay) methods.pausePlay.update("pause");
|
|
// SYNC:
|
|
if (slider.syncExists) methods.sync("play");
|
|
}
|
|
slider.canAdvance = function(target) {
|
|
// ASNAV:
|
|
var last = (asNav) ? slider.pagingCount - 1 : slider.last;
|
|
return (asNav && slider.currentItem === 0 && target === slider.pagingCount - 1 && slider.direction !== "next") ? false :
|
|
(target === slider.currentSlide && !asNav) ? false :
|
|
(vars.animationLoop) ? true :
|
|
(slider.atEnd && slider.currentSlide === 0 && target === last && slider.direction !== "next") ? false :
|
|
(slider.atEnd && slider.currentSlide === last && target === 0 && slider.direction === "next") ? false :
|
|
true;
|
|
}
|
|
slider.getTarget = function(dir) {
|
|
slider.direction = dir;
|
|
if (dir === "next") {
|
|
|
|
return (slider.currentSlide === slider.last) ? 0 : slider.currentSlide + 1;
|
|
|
|
} else {
|
|
return (slider.currentSlide === 0) ? slider.last : slider.currentSlide - 1;
|
|
}
|
|
}
|
|
|
|
// SLIDE:
|
|
slider.setProps = function(pos, special, dur) {
|
|
var target = (function() {
|
|
var posCheck = (pos) ? pos : ((slider.itemW + vars.itemMargin) * slider.move) * slider.animatingTo,
|
|
posCalc = (function() {
|
|
if (carousel) {
|
|
return (special === "setTouch") ? pos :
|
|
(reverse && slider.animatingTo === slider.last) ? 0 :
|
|
(reverse) ? slider.limit - (((slider.itemW + vars.itemMargin) * slider.move) * slider.animatingTo) :
|
|
(slider.animatingTo === slider.last) ? slider.limit : posCheck;
|
|
} else {
|
|
switch (special) {
|
|
case "setTotal": return (reverse) ? ((slider.count - 1) - slider.currentSlide + slider.cloneOffset) * pos : (slider.currentSlide + slider.cloneOffset) * pos;
|
|
case "setTouch": return (reverse) ? pos : pos;
|
|
case "jumpEnd": return (reverse) ? pos : slider.count * pos;
|
|
case "jumpStart": return (reverse) ? slider.count * pos : pos;
|
|
default: return pos;
|
|
}
|
|
}
|
|
}());
|
|
return (posCalc * -1) + "px";
|
|
}());
|
|
|
|
if (slider.transitions) {
|
|
target = (vertical) ? "translate3d(0," + target + ",0)" : "translate3d(" + target + ",0,0)";
|
|
dur = (dur !== undefined) ? (dur/1000) + "s" : "0s";
|
|
slider.container.css("-" + slider.pfx + "-transition-duration", dur);
|
|
}
|
|
|
|
slider.args[slider.prop] = target;
|
|
if (slider.transitions || dur === undefined) slider.container.css(slider.args);
|
|
}
|
|
|
|
slider.setup = function(type) {
|
|
// SLIDE:
|
|
if (!fade) {
|
|
var sliderOffset, arr;
|
|
|
|
if (type === "init") {
|
|
slider.viewport = $('<div class="flex-viewport"></div>').css({"overflow": "hidden", "position": "relative"}).appendTo(slider).append(slider.container);
|
|
// INFINITE LOOP:
|
|
slider.cloneCount = 0;
|
|
slider.cloneOffset = 0;
|
|
// REVERSE:
|
|
if (reverse) {
|
|
arr = $.makeArray(slider.slides).reverse();
|
|
slider.slides = $(arr);
|
|
slider.container.empty().append(slider.slides);
|
|
}
|
|
}
|
|
// INFINITE LOOP && !CAROUSEL:
|
|
if (vars.animationLoop && !carousel) {
|
|
slider.cloneCount = 2;
|
|
slider.cloneOffset = 1;
|
|
// clear out old clones
|
|
if (type !== "init") slider.container.find('.clone').remove();
|
|
slider.container.append(slider.slides.first().clone().addClass('clone')).prepend(slider.slides.last().clone().addClass('clone'));
|
|
}
|
|
slider.newSlides = $(vars.selector, slider);
|
|
|
|
sliderOffset = (reverse) ? slider.count - 1 - slider.currentSlide + slider.cloneOffset : slider.currentSlide + slider.cloneOffset;
|
|
// VERTICAL:
|
|
if (vertical && !carousel) {
|
|
slider.container.height((slider.count + slider.cloneCount) * 200 + "%").css("position", "absolute").width("100%");
|
|
setTimeout(function(){
|
|
slider.newSlides.css({"display": "block"});
|
|
slider.doMath();
|
|
slider.viewport.height(slider.h);
|
|
slider.setProps(sliderOffset * slider.h, "init");
|
|
}, (type === "init") ? 100 : 0);
|
|
} else {
|
|
slider.container.width((slider.count + slider.cloneCount) * 200 + "%");
|
|
slider.setProps(sliderOffset * slider.computedW, "init");
|
|
setTimeout(function(){
|
|
slider.doMath();
|
|
slider.newSlides.css({"width": slider.computedW, "float": "left", "display": "block"});
|
|
// SMOOTH HEIGHT:
|
|
if (vars.smoothHeight) methods.smoothHeight();
|
|
}, (type === "init") ? 100 : 0);
|
|
}
|
|
} else { // FADE:
|
|
slider.slides.css({"width": "100%", "float": "left", "marginRight": "-100%", "position": "relative"});
|
|
$(".html-caption").hide();
|
|
$(".flex-direction-nav").hide();
|
|
if (type === "init") slider.slides.eq(slider.currentSlide).fadeIn(vars.animationSpeed, vars.easing, function(){
|
|
$('.html-caption').fadeIn(1000);
|
|
$('.flex-direction-nav').fadeIn(1000);
|
|
});
|
|
// SMOOTH HEIGHT:
|
|
if (vars.smoothHeight) methods.smoothHeight();
|
|
}
|
|
// !CAROUSEL:
|
|
// CANDIDATE: active slide
|
|
if (!carousel) slider.slides.removeClass(namespace + "active-slide").eq(slider.currentSlide).addClass(namespace + "active-slide");
|
|
var $_currentPage = slider.slides.eq(slider.currentSlide);
|
|
if($_currentPage.find('iframe').length > 0) {
|
|
$('.flexslider ').addClass('anything-video');
|
|
$('iframe', $_currentPage).css({
|
|
'visibility':'visible'
|
|
})
|
|
$('.border, .border-dark', $_currentPage).css({
|
|
'visibility':'hidden'
|
|
})
|
|
}
|
|
else {
|
|
$('.flexslider ').removeClass('anything-video');
|
|
$('.flexslider iframe').css({
|
|
'visibility':'hidden'
|
|
})
|
|
$('.border, .border-dark').css({
|
|
'visibility':'visible'
|
|
})
|
|
}
|
|
|
|
|
|
}
|
|
|
|
slider.doMath = function() {
|
|
var slide = slider.slides.first(),
|
|
slideMargin = vars.itemMargin,
|
|
minItems = vars.minItems,
|
|
maxItems = vars.maxItems;
|
|
|
|
slider.w = slider.width();
|
|
slider.h = slide.height();
|
|
slider.boxPadding = slide.outerWidth() - slide.width();
|
|
|
|
// CAROUSEL:
|
|
if (carousel) {
|
|
slider.itemT = vars.itemWidth + slideMargin;
|
|
slider.minW = (minItems) ? minItems * slider.itemT : slider.w;
|
|
slider.maxW = (maxItems) ? maxItems * slider.itemT : slider.w;
|
|
slider.itemW = (slider.minW > slider.w) ? (slider.w - (slideMargin * minItems))/minItems :
|
|
(slider.maxW < slider.w) ? (slider.w - (slideMargin * maxItems))/maxItems :
|
|
(vars.itemWidth > slider.w) ? slider.w : vars.itemWidth;
|
|
slider.visible = Math.floor(slider.w/(slider.itemW + slideMargin));
|
|
slider.move = (vars.move > 0 && vars.move < slider.visible ) ? vars.move : slider.visible;
|
|
slider.pagingCount = Math.ceil(((slider.count - slider.visible)/slider.move) + 1);
|
|
slider.last = slider.pagingCount - 1;
|
|
slider.limit = (slider.pagingCount === 1) ? 0 :
|
|
(vars.itemWidth > slider.w) ? ((slider.itemW + (slideMargin * 2)) * slider.count) - slider.w - slideMargin : ((slider.itemW + slideMargin) * slider.count) - slider.w;
|
|
} else {
|
|
slider.itemW = slider.w;
|
|
slider.pagingCount = slider.count;
|
|
slider.last = slider.count - 1;
|
|
}
|
|
slider.computedW = slider.itemW - slider.boxPadding;
|
|
}
|
|
|
|
slider.update = function(pos, action) {
|
|
slider.doMath();
|
|
|
|
// update currentSlide and slider.animatingTo if necessary
|
|
if (!carousel) {
|
|
if (pos < slider.currentSlide) {
|
|
slider.currentSlide += 1;
|
|
} else if (pos <= slider.currentSlide && pos !== 0) {
|
|
slider.currentSlide -= 1;
|
|
}
|
|
slider.animatingTo = slider.currentSlide;
|
|
}
|
|
|
|
// update controlNav
|
|
if (vars.controlNav && !slider.manualControls) {
|
|
if ((action === "add" && !carousel) || slider.pagingCount > slider.controlNav.length) {
|
|
methods.controlNav.update("add");
|
|
} else if ((action === "remove" && !carousel) || slider.pagingCount < slider.controlNav.length) {
|
|
if (carousel && slider.currentSlide > slider.last) {
|
|
slider.currentSlide -= 1;
|
|
slider.animatingTo -= 1;
|
|
}
|
|
methods.controlNav.update("remove", slider.last);
|
|
}
|
|
}
|
|
// update directionNav
|
|
if (vars.directionNav) methods.directionNav.update();
|
|
|
|
}
|
|
|
|
slider.addSlide = function(obj, pos) {
|
|
var $obj = $(obj);
|
|
|
|
slider.count += 1;
|
|
slider.last = slider.count - 1;
|
|
|
|
// append new slide
|
|
if (vertical && reverse) {
|
|
(pos !== undefined) ? slider.slides.eq(slider.count - pos).after($obj) : slider.container.prepend($obj);
|
|
} else {
|
|
(pos !== undefined) ? slider.slides.eq(pos).before($obj) : slider.container.append($obj);
|
|
}
|
|
|
|
// update currentSlide, animatingTo, controlNav, and directionNav
|
|
slider.update(pos, "add");
|
|
|
|
// update slider.slides
|
|
slider.slides = $(vars.selector + ':not(.clone)', slider);
|
|
// re-setup the slider to accomdate new slide
|
|
slider.setup();
|
|
|
|
//FlexSlider: added() Callback
|
|
vars.added(slider);
|
|
}
|
|
slider.removeSlide = function(obj) {
|
|
var pos = (isNaN(obj)) ? slider.slides.index($(obj)) : obj;
|
|
|
|
// update count
|
|
slider.count -= 1;
|
|
slider.last = slider.count - 1;
|
|
|
|
// remove slide
|
|
if (isNaN(obj)) {
|
|
$(obj, slider.slides).remove();
|
|
} else {
|
|
(vertical && reverse) ? slider.slides.eq(slider.last).remove() : slider.slides.eq(obj).remove();
|
|
}
|
|
|
|
// update currentSlide, animatingTo, controlNav, and directionNav
|
|
slider.doMath();
|
|
slider.update(pos, "remove");
|
|
|
|
// update slider.slides
|
|
slider.slides = $(vars.selector + ':not(.clone)', slider);
|
|
// re-setup the slider to accomdate new slide
|
|
slider.setup();
|
|
|
|
// FlexSlider: removed() Callback
|
|
vars.removed(slider);
|
|
}
|
|
|
|
//FlexSlider: Initialize
|
|
methods.init();
|
|
|
|
|
|
var target = ($(this).hasClass(namespace + 'next')) ? slider.getTarget('next') : slider.getTarget('prev');
|
|
//slider.flexAnimate(target, vars.pauseOnAction);
|
|
|
|
|
|
slider.touchwipe({
|
|
wipeLeft: function() {
|
|
var target = slider.getTarget('next');
|
|
slider.flexAnimate(target, vars.pauseOnAction);
|
|
},
|
|
wipeRight: function() {
|
|
var target = slider.getTarget('prev');
|
|
slider.flexAnimate(target, vars.pauseOnAction);
|
|
},
|
|
min_move_x: 30,
|
|
min_move_y: 20,
|
|
preventDefaultEvents: false,
|
|
dtPreventX: true
|
|
});
|
|
|
|
}
|
|
|
|
//FlexSlider: Default Settings
|
|
$.flexslider.defaults = {
|
|
namespace: "flex-", //{NEW} String: Prefix string attached to the class of every element generated by the plugin
|
|
selector: ".slides > li", //{NEW} Selector: Must match a simple pattern. '{container} > {slide}' -- Ignore pattern at your own peril
|
|
animation: "fade", //String: Select your animation type, "fade" or "slide"
|
|
easing: "swing", //{NEW} String: Determines the easing method used in jQuery transitions. jQuery easing plugin is supported!
|
|
direction: "horizontal", //String: Select the sliding direction, "horizontal" or "vertical"
|
|
reverse: false, //{NEW} Boolean: Reverse the animation direction
|
|
animationLoop: true, //Boolean: Should the animation loop? If false, directionNav will received "disable" classes at either end
|
|
smoothHeight: false, //{NEW} Boolean: Allow height of the slider to animate smoothly in horizontal mode
|
|
startAt: 0, //Integer: The slide that the slider should start on. Array notation (0 = first slide)
|
|
slideshow: false, //Boolean: Animate slider automatically
|
|
slideshowSpeed: 7000, //Integer: Set the speed of the slideshow cycling, in milliseconds
|
|
animationSpeed: 600, //Integer: Set the speed of animations, in milliseconds
|
|
initDelay: 0, //{NEW} Integer: Set an initialization delay, in milliseconds
|
|
randomize: false, //Boolean: Randomize slide order
|
|
|
|
// Usability features
|
|
pauseOnAction: true, //Boolean: Pause the slideshow when interacting with control elements, highly recommended.
|
|
pauseOnHover: false, //Boolean: Pause the slideshow when hovering over slider, then resume when no longer hovering
|
|
useCSS: true, //{NEW} Boolean: Slider will use CSS3 transitions if available
|
|
touch: false, //{NEW} Boolean: Allow touch swipe navigation of the slider on touch-enabled devices
|
|
video: false, //{NEW} Boolean: If using video in the slider, will prevent CSS3 3D Transforms to avoid graphical glitches
|
|
|
|
// Primary Controls
|
|
controlNav: true, //Boolean: Create navigation for paging control of each clide? Note: Leave true for manualControls usage
|
|
directionNav: true, //Boolean: Create navigation for previous/next navigation? (true/false)
|
|
prevText: "Previous", //String: Set the text for the "previous" directionNav item
|
|
nextText: "Next", //String: Set the text for the "next" directionNav item
|
|
|
|
// Secondary Navigation
|
|
keyboard: true, //Boolean: Allow slider navigating via keyboard left/right keys
|
|
multipleKeyboard: false, //{NEW} Boolean: Allow keyboard navigation to affect multiple sliders. Default behavior cuts out keyboard navigation with more than one slider present.
|
|
mousewheel: false, //{UPDATED} Boolean: Requires jquery.mousewheel.js (https://github.com/brandonaaron/jquery-mousewheel) - Allows slider navigating via mousewheel
|
|
pausePlay: false, //Boolean: Create pause/play dynamic element
|
|
pauseText: "Pause", //String: Set the text for the "pause" pausePlay item
|
|
playText: "Play", //String: Set the text for the "play" pausePlay item
|
|
|
|
// Special properties
|
|
controlsContainer: "", //{UPDATED} jQuery Object/Selector: Declare which container the navigation elements should be appended too. Default container is the FlexSlider element. Example use would be $(".flexslider-container"). Property is ignored if given element is not found.
|
|
manualControls: "", //{UPDATED} jQuery Object/Selector: Declare custom control navigation. Examples would be $(".flex-control-nav li") or "#tabs-nav li img", etc. The number of elements in your controlNav should match the number of slides/tabs.
|
|
sync: "", //{NEW} Selector: Mirror the actions performed on this slider with another slider. Use with care.
|
|
asNavFor: "", //{NEW} Selector: Internal property exposed for turning the slider into a thumbnail navigation for another slider
|
|
|
|
// Carousel Options
|
|
itemWidth: 0, //{NEW} Integer: Box-model width of individual carousel items, including horizontal borders and padding.
|
|
itemMargin: 0, //{NEW} Integer: Margin between carousel items.
|
|
minItems: 0, //{NEW} Integer: Minimum number of carousel items that should be visible. Items will resize fluidly when below this.
|
|
maxItems: 0, //{NEW} Integer: Maxmimum number of carousel items that should be visible. Items will resize fluidly when above this limit.
|
|
move: 0, //{NEW} Integer: Number of carousel items that should move on animation. If 0, slider will move all visible items.
|
|
|
|
// Callback API
|
|
start: function(){}, //Callback: function(slider) - Fires when the slider loads the first slide
|
|
before: function(){}, //Callback: function(slider) - Fires asynchronously with each slider animation
|
|
after: function(){}, //Callback: function(slider) - Fires after each slider animation completes
|
|
end: function(){}, //Callback: function(slider) - Fires when the slider reaches the last slide (asynchronous)
|
|
added: function(){}, //{NEW} Callback: function(slider) - Fires after a slide is added
|
|
removed: function(){} //{NEW} Callback: function(slider) - Fires after a slide is removed
|
|
}
|
|
|
|
|
|
//FlexSlider: Plugin Function
|
|
$.fn.flexslider = function(options) {
|
|
options = options || {};
|
|
if (typeof options === "object") {
|
|
return this.each(function() {
|
|
var $this = $(this),
|
|
selector = (options.selector) ? options.selector : ".slides > li",
|
|
$slides = $this.find(selector);
|
|
|
|
if ($slides.length === 1) {
|
|
$slides.fadeIn(400);
|
|
if (options.start) options.start($this);
|
|
} else if ($this.data('flexslider') === undefined) {
|
|
new $.flexslider(this, options);
|
|
}
|
|
});
|
|
} else {
|
|
// Helper strings to quickly perform functions on the slider
|
|
var $slider = $(this).data('flexslider');
|
|
switch (options) {
|
|
case "play": $slider.play(); break;
|
|
case "pause": $slider.pause(); break;
|
|
case "next": $slider.flexAnimate($slider.getTarget("next"), true); break;
|
|
case "prev":
|
|
case "previous": $slider.flexAnimate($slider.getTarget("prev"), true); break;
|
|
default: if (typeof options === "number") $slider.flexAnimate(options, true);
|
|
}
|
|
}
|
|
}
|
|
|
|
});
|
|
/*********************************************************************************************************************************/
|
|
|
|
/*
|
|
* Pixastic Lib - Core Functions - v0.1.3
|
|
* Copyright (c) 2008 Jacob Seidelin, jseidelin@nihilogic.dk, http://blog.nihilogic.dk/
|
|
* License: [http://www.pixastic.com/lib/license.txt]
|
|
*/
|
|
|
|
var Pixastic = (function() {
|
|
|
|
|
|
function addEvent(el, event, handler) {
|
|
if (el.addEventListener)
|
|
el.addEventListener(event, handler, false);
|
|
else if (el.attachEvent)
|
|
el.attachEvent("on" + event, handler);
|
|
}
|
|
|
|
function onready(handler) {
|
|
var handlerDone = false;
|
|
var execHandler = function() {
|
|
if (!handlerDone) {
|
|
handlerDone = true;
|
|
handler();
|
|
}
|
|
}
|
|
document.write("<"+"script defer src=\"//:\" id=\"__onload_ie_pixastic__\"></"+"script>");
|
|
var script = document.getElementById("__onload_ie_pixastic__");
|
|
script.onreadystatechange = function() {
|
|
if (script.readyState == "complete") {
|
|
script.parentNode.removeChild(script);
|
|
execHandler();
|
|
}
|
|
}
|
|
if (document.addEventListener)
|
|
document.addEventListener("DOMContentLoaded", execHandler, false);
|
|
addEvent(window, "load", execHandler);
|
|
}
|
|
|
|
function init() {
|
|
var imgEls = getElementsByClass("pixastic", null, "img");
|
|
var canvasEls = getElementsByClass("pixastic", null, "canvas");
|
|
var elements = imgEls.concat(canvasEls);
|
|
for (var i=0;i<elements.length;i++) {
|
|
(function() {
|
|
|
|
var el = elements[i];
|
|
var actions = [];
|
|
var classes = el.className.split(" ");
|
|
for (var c=0;c<classes.length;c++) {
|
|
var cls = classes[c];
|
|
if (cls.substring(0,9) == "pixastic-") {
|
|
var actionName = cls.substring(9);
|
|
if (actionName != "")
|
|
actions.push(actionName);
|
|
}
|
|
}
|
|
if (actions.length) {
|
|
if (el.tagName.toLowerCase() == "img") {
|
|
var dataImg = new Image();
|
|
dataImg.src = el.src;
|
|
if (dataImg.complete) {
|
|
for (var a=0;a<actions.length;a++) {
|
|
var res = Pixastic.applyAction(el, el, actions[a], null);
|
|
if (res)
|
|
el = res;
|
|
}
|
|
} else {
|
|
dataImg.onload = function() {
|
|
for (var a=0;a<actions.length;a++) {
|
|
var res = Pixastic.applyAction(el, el, actions[a], null)
|
|
if (res)
|
|
el = res;
|
|
}
|
|
}
|
|
}
|
|
} else {
|
|
setTimeout(function() {
|
|
for (var a=0;a<actions.length;a++) {
|
|
var res = Pixastic.applyAction(
|
|
el, el, actions[a], null
|
|
);
|
|
if (res)
|
|
el = res;
|
|
}
|
|
},1);
|
|
}
|
|
}
|
|
|
|
})();
|
|
}
|
|
}
|
|
|
|
if (typeof pixastic_parseonload != "undefined" && pixastic_parseonload)
|
|
onready(init);
|
|
|
|
// getElementsByClass by Dustin Diaz, http://www.dustindiaz.com/getelementsbyclass/
|
|
function getElementsByClass(searchClass,node,tag) {
|
|
var classElements = new Array();
|
|
if ( node == null )
|
|
node = document;
|
|
if ( tag == null )
|
|
tag = '*';
|
|
|
|
var els = node.getElementsByTagName(tag);
|
|
var elsLen = els.length;
|
|
var pattern = new RegExp("(^|\\s)"+searchClass+"(\\s|$)");
|
|
for (i = 0, j = 0; i < elsLen; i++) {
|
|
if ( pattern.test(els[i].className) ) {
|
|
classElements[j] = els[i];
|
|
j++;
|
|
}
|
|
}
|
|
return classElements;
|
|
}
|
|
|
|
var debugElement;
|
|
|
|
function writeDebug(text, level) {
|
|
if (!Pixastic.debug) return;
|
|
try {
|
|
switch (level) {
|
|
case "warn" :
|
|
console.warn("Pixastic:", text);
|
|
break;
|
|
case "error" :
|
|
console.error("Pixastic:", text);
|
|
break;
|
|
default:
|
|
console.log("Pixastic:", text);
|
|
}
|
|
} catch(e) {
|
|
}
|
|
if (!debugElement) {
|
|
|
|
}
|
|
}
|
|
|
|
// canvas capability checks
|
|
|
|
var hasCanvas = (function() {
|
|
var c = document.createElement("canvas");
|
|
var val = false;
|
|
try {
|
|
val = !!((typeof c.getContext == "function") && c.getContext("2d"));
|
|
} catch(e) {}
|
|
return function() {
|
|
return val;
|
|
}
|
|
})();
|
|
|
|
var hasCanvasImageData = (function() {
|
|
var c = document.createElement("canvas");
|
|
var val = false;
|
|
var ctx;
|
|
try {
|
|
if (typeof c.getContext == "function" && (ctx = c.getContext("2d"))) {
|
|
val = (typeof ctx.getImageData == "function");
|
|
}
|
|
} catch(e) {}
|
|
return function() {
|
|
return val;
|
|
}
|
|
})();
|
|
|
|
var hasGlobalAlpha = (function() {
|
|
var hasAlpha = false;
|
|
var red = document.createElement("canvas");
|
|
if (hasCanvas() && hasCanvasImageData()) {
|
|
red.width = red.height = 1;
|
|
var redctx = red.getContext("2d");
|
|
redctx.fillStyle = "rgb(255,0,0)";
|
|
redctx.fillRect(0,0,1,1);
|
|
|
|
var blue = document.createElement("canvas");
|
|
blue.width = blue.height = 1;
|
|
var bluectx = blue.getContext("2d");
|
|
bluectx.fillStyle = "rgb(0,0,255)";
|
|
bluectx.fillRect(0,0,1,1);
|
|
|
|
redctx.globalAlpha = 0.5;
|
|
redctx.drawImage(blue, 0, 0);
|
|
var reddata = redctx.getImageData(0,0,1,1).data;
|
|
|
|
hasAlpha = (reddata[2] != 255);
|
|
}
|
|
return function() {
|
|
return hasAlpha;
|
|
}
|
|
})();
|
|
|
|
|
|
// return public interface
|
|
|
|
return {
|
|
|
|
parseOnLoad : false,
|
|
|
|
debug : false,
|
|
|
|
applyAction : function(img, dataImg, actionName, options) {
|
|
|
|
options = options || {};
|
|
|
|
var imageIsCanvas = (img.tagName.toLowerCase() == "canvas");
|
|
if (imageIsCanvas && Pixastic.Client.isIE()) {
|
|
if (Pixastic.debug) writeDebug("Tried to process a canvas element but browser is IE.");
|
|
return false;
|
|
}
|
|
|
|
var canvas, ctx;
|
|
var hasOutputCanvas = false;
|
|
if (Pixastic.Client.hasCanvas()) {
|
|
hasOutputCanvas = !!options.resultCanvas;
|
|
canvas = options.resultCanvas || document.createElement("canvas");
|
|
ctx = canvas.getContext("2d");
|
|
}
|
|
|
|
var w = img.offsetWidth;
|
|
var h = img.offsetHeight;
|
|
|
|
if (imageIsCanvas) {
|
|
w = img.width;
|
|
h = img.height;
|
|
}
|
|
|
|
// offsetWidth/Height might be 0 if the image is not in the document
|
|
if (w == 0 || h == 0) {
|
|
if (img.parentNode == null) {
|
|
// add the image to the doc (way out left), read its dimensions and remove it again
|
|
var oldpos = img.style.position;
|
|
var oldleft = img.style.left;
|
|
img.style.position = "absolute";
|
|
img.style.left = "-9999px";
|
|
document.body.appendChild(img);
|
|
w = img.offsetWidth;
|
|
h = img.offsetHeight;
|
|
document.body.removeChild(img);
|
|
img.style.position = oldpos;
|
|
img.style.left = oldleft;
|
|
} else {
|
|
if (Pixastic.debug) writeDebug("Image has 0 width and/or height.");
|
|
return;
|
|
}
|
|
}
|
|
|
|
if (actionName.indexOf("(") > -1) {
|
|
var tmp = actionName;
|
|
actionName = tmp.substr(0, tmp.indexOf("("));
|
|
var arg = tmp.match(/\((.*?)\)/);
|
|
if (arg[1]) {
|
|
arg = arg[1].split(";");
|
|
for (var a=0;a<arg.length;a++) {
|
|
thisArg = arg[a].split("=");
|
|
if (thisArg.length == 2) {
|
|
if (thisArg[0] == "rect") {
|
|
var rectVal = thisArg[1].split(",");
|
|
options[thisArg[0]] = {
|
|
left : parseInt(rectVal[0],10)||0,
|
|
top : parseInt(rectVal[1],10)||0,
|
|
width : parseInt(rectVal[2],10)||0,
|
|
height : parseInt(rectVal[3],10)||0
|
|
}
|
|
} else {
|
|
options[thisArg[0]] = thisArg[1];
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
if (!options.rect) {
|
|
options.rect = {
|
|
left : 0, top : 0, width : w, height : h
|
|
};
|
|
} else {
|
|
options.rect.left = Math.round(options.rect.left);
|
|
options.rect.top = Math.round(options.rect.top);
|
|
options.rect.width = Math.round(options.rect.width);
|
|
options.rect.height = Math.round(options.rect.height);
|
|
}
|
|
|
|
var validAction = false;
|
|
if (Pixastic.Actions[actionName] && typeof Pixastic.Actions[actionName].process == "function") {
|
|
validAction = true;
|
|
}
|
|
if (!validAction) {
|
|
if (Pixastic.debug) writeDebug("Invalid action \"" + actionName + "\". Maybe file not included?");
|
|
return false;
|
|
}
|
|
if (!Pixastic.Actions[actionName].checkSupport()) {
|
|
if (Pixastic.debug) writeDebug("Action \"" + actionName + "\" not supported by this browser.");
|
|
return false;
|
|
}
|
|
|
|
if (Pixastic.Client.hasCanvas()) {
|
|
if (canvas !== img) {
|
|
canvas.width = w;
|
|
canvas.height = h;
|
|
}
|
|
if (!hasOutputCanvas) {
|
|
canvas.style.width = w+"px";
|
|
canvas.style.height = h+"px";
|
|
}
|
|
ctx.drawImage(dataImg,0,0,w,h);
|
|
|
|
if (!img.__pixastic_org_image) {
|
|
canvas.__pixastic_org_image = img;
|
|
canvas.__pixastic_org_width = w;
|
|
canvas.__pixastic_org_height = h;
|
|
} else {
|
|
canvas.__pixastic_org_image = img.__pixastic_org_image;
|
|
canvas.__pixastic_org_width = img.__pixastic_org_width;
|
|
canvas.__pixastic_org_height = img.__pixastic_org_height;
|
|
}
|
|
|
|
} else if (Pixastic.Client.isIE() && typeof img.__pixastic_org_style == "undefined") {
|
|
img.__pixastic_org_style = img.style.cssText;
|
|
}
|
|
|
|
var params = {
|
|
image : img,
|
|
canvas : canvas,
|
|
width : w,
|
|
height : h,
|
|
useData : true,
|
|
options : options
|
|
}
|
|
|
|
// Ok, let's do it!
|
|
|
|
var res = Pixastic.Actions[actionName].process(params);
|
|
|
|
if (!res) {
|
|
return false;
|
|
}
|
|
|
|
if (Pixastic.Client.hasCanvas()) {
|
|
if (params.useData) {
|
|
if (Pixastic.Client.hasCanvasImageData()) {
|
|
canvas.getContext("2d").putImageData(params.canvasData, options.rect.left, options.rect.top);
|
|
|
|
// Opera doesn't seem to update the canvas until we draw something on it, lets draw a 0x0 rectangle.
|
|
// Is this still so?
|
|
canvas.getContext("2d").fillRect(0,0,0,0);
|
|
}
|
|
}
|
|
|
|
if (!options.leaveDOM) {
|
|
// copy properties and stuff from the source image
|
|
canvas.title = img.title;
|
|
canvas.imgsrc = img.imgsrc;
|
|
if (!imageIsCanvas) canvas.alt = img.alt;
|
|
if (!imageIsCanvas) canvas.imgsrc = img.src;
|
|
canvas.className = img.className;
|
|
canvas.style.cssText = img.style.cssText;
|
|
canvas.name = img.name;
|
|
canvas.tabIndex = img.tabIndex;
|
|
canvas.id = img.id;
|
|
if (img.parentNode && img.parentNode.replaceChild) {
|
|
img.parentNode.replaceChild(canvas, img);
|
|
}
|
|
}
|
|
|
|
options.resultCanvas = canvas;
|
|
|
|
return canvas;
|
|
}
|
|
|
|
return img;
|
|
},
|
|
|
|
prepareData : function(params, getCopy) {
|
|
var ctx = params.canvas.getContext("2d");
|
|
var rect = params.options.rect;
|
|
var dataDesc = ctx.getImageData(rect.left, rect.top, rect.width, rect.height);
|
|
var data = dataDesc.data;
|
|
if (!getCopy) params.canvasData = dataDesc;
|
|
return data;
|
|
},
|
|
|
|
// load the image file
|
|
process : function(img, actionName, options, callback) {
|
|
if (img.tagName.toLowerCase() == "img") {
|
|
var dataImg = new Image();
|
|
dataImg.src = img.src;
|
|
if (dataImg.complete) {
|
|
var res = Pixastic.applyAction(img, dataImg, actionName, options);
|
|
if (callback) callback(res);
|
|
return res;
|
|
} else {
|
|
dataImg.onload = function() {
|
|
var res = Pixastic.applyAction(img, dataImg, actionName, options)
|
|
if (callback) callback(res);
|
|
}
|
|
}
|
|
}
|
|
if (img.tagName.toLowerCase() == "canvas") {
|
|
var res = Pixastic.applyAction(img, img, actionName, options);
|
|
if (callback) callback(res);
|
|
return res;
|
|
}
|
|
},
|
|
|
|
revert : function(img) {
|
|
if (Pixastic.Client.hasCanvas()) {
|
|
if (img.tagName.toLowerCase() == "canvas" && img.__pixastic_org_image) {
|
|
img.width = img.__pixastic_org_width;
|
|
img.height = img.__pixastic_org_height;
|
|
img.getContext("2d").drawImage(img.__pixastic_org_image, 0, 0);
|
|
|
|
if (img.parentNode && img.parentNode.replaceChild) {
|
|
img.parentNode.replaceChild(img.__pixastic_org_image, img);
|
|
}
|
|
|
|
return img;
|
|
}
|
|
} else if (Pixastic.Client.isIE()) {
|
|
if (typeof img.__pixastic_org_style != "undefined")
|
|
img.style.cssText = img.__pixastic_org_style;
|
|
}
|
|
},
|
|
|
|
Client : {
|
|
hasCanvas : hasCanvas,
|
|
hasCanvasImageData : hasCanvasImageData,
|
|
hasGlobalAlpha : hasGlobalAlpha,
|
|
isIE : function() {
|
|
return !!document.all && !!window.attachEvent && !window.opera;
|
|
}
|
|
},
|
|
|
|
Actions : {}
|
|
}
|
|
|
|
|
|
})();
|
|
/*
|
|
* Pixastic Lib - jQuery plugin
|
|
* Copyright (c) 2008 Jacob Seidelin, jseidelin@nihilogic.dk, http://blog.nihilogic.dk/
|
|
* License: [http://www.pixastic.com/lib/license.txt]
|
|
*/
|
|
|
|
if (typeof jQuery != "undefined" && jQuery && jQuery.fn) {
|
|
jQuery.fn.pixastic = function(action, options) {
|
|
var newElements = [];
|
|
this.each(
|
|
function () {
|
|
if (this.tagName.toLowerCase() == "img" && !this.complete) {
|
|
return;
|
|
}
|
|
var res = Pixastic.process(this, action, options);
|
|
if (res) {
|
|
newElements.push(res);
|
|
}
|
|
}
|
|
);
|
|
if (newElements.length > 0)
|
|
return jQuery(newElements);
|
|
else
|
|
return this;
|
|
};
|
|
|
|
};
|
|
/*
|
|
* Pixastic Lib - Blur filter - v0.1.0
|
|
* Copyright (c) 2008 Jacob Seidelin, jseidelin@nihilogic.dk, http://blog.nihilogic.dk/
|
|
* License: [http://www.pixastic.com/lib/license.txt]
|
|
*/
|
|
|
|
Pixastic.Actions.blur = {
|
|
process : function(params) {
|
|
|
|
if (typeof params.options.fixMargin == "undefined")
|
|
params.options.fixMargin = true;
|
|
|
|
if (Pixastic.Client.hasCanvasImageData()) {
|
|
var data = Pixastic.prepareData(params);
|
|
var dataCopy = Pixastic.prepareData(params, true)
|
|
|
|
/*
|
|
var kernel = [
|
|
[0.5, 1, 0.5],
|
|
[1, 2, 1],
|
|
[0.5, 1, 0.5]
|
|
];
|
|
*/
|
|
|
|
var kernel = [
|
|
[0, 1, 0],
|
|
[1, 2, 1],
|
|
[0, 1, 0]
|
|
];
|
|
|
|
var weight = 0;
|
|
for (var i=0;i<3;i++) {
|
|
for (var j=0;j<3;j++) {
|
|
weight += kernel[i][j];
|
|
}
|
|
}
|
|
|
|
weight = 1 / (weight*2);
|
|
|
|
var rect = params.options.rect;
|
|
var w = rect.width;
|
|
var h = rect.height;
|
|
|
|
var w4 = w*4;
|
|
var y = h;
|
|
do {
|
|
var offsetY = (y-1)*w4;
|
|
|
|
var prevY = (y == 1) ? 0 : y-2;
|
|
var nextY = (y == h) ? y - 1 : y;
|
|
|
|
var offsetYPrev = prevY*w*4;
|
|
var offsetYNext = nextY*w*4;
|
|
|
|
var x = w;
|
|
do {
|
|
var offset = offsetY + (x*4-4);
|
|
|
|
var offsetPrev = offsetYPrev + ((x == 1) ? 0 : x-2) * 4;
|
|
var offsetNext = offsetYNext + ((x == w) ? x-1 : x) * 4;
|
|
|
|
data[offset] = (
|
|
/*
|
|
dataCopy[offsetPrev - 4]
|
|
+ dataCopy[offsetPrev+4]
|
|
+ dataCopy[offsetNext - 4]
|
|
+ dataCopy[offsetNext+4]
|
|
+
|
|
*/
|
|
(dataCopy[offsetPrev]
|
|
+ dataCopy[offset-4]
|
|
+ dataCopy[offset+4]
|
|
+ dataCopy[offsetNext]) * 2
|
|
+ dataCopy[offset] * 4
|
|
) * weight;
|
|
|
|
data[offset+1] = (
|
|
/*
|
|
dataCopy[offsetPrev - 3]
|
|
+ dataCopy[offsetPrev+5]
|
|
+ dataCopy[offsetNext - 3]
|
|
+ dataCopy[offsetNext+5]
|
|
+
|
|
*/
|
|
(dataCopy[offsetPrev+1]
|
|
+ dataCopy[offset-3]
|
|
+ dataCopy[offset+5]
|
|
+ dataCopy[offsetNext+1]) * 2
|
|
+ dataCopy[offset+1] * 4
|
|
) * weight;
|
|
|
|
data[offset+2] = (
|
|
/*
|
|
dataCopy[offsetPrev - 2]
|
|
+ dataCopy[offsetPrev+6]
|
|
+ dataCopy[offsetNext - 2]
|
|
+ dataCopy[offsetNext+6]
|
|
+
|
|
*/
|
|
(dataCopy[offsetPrev+2]
|
|
+ dataCopy[offset-2]
|
|
+ dataCopy[offset+6]
|
|
+ dataCopy[offsetNext+2]) * 2
|
|
+ dataCopy[offset+2] * 4
|
|
) * weight;
|
|
|
|
} while (--x);
|
|
} while (--y);
|
|
|
|
return true;
|
|
|
|
} else if (Pixastic.Client.isIE()) {
|
|
params.image.style.filter += " progid:DXImageTransform.Microsoft.Blur(pixelradius=1.5)";
|
|
|
|
if (params.options.fixMargin) {
|
|
params.image.style.marginLeft = (parseInt(params.image.style.marginLeft,10)||0) - 2 + "px";
|
|
params.image.style.marginTop = (parseInt(params.image.style.marginTop,10)||0) - 2 + "px";
|
|
}
|
|
|
|
return true;
|
|
}
|
|
},
|
|
checkSupport : function() {
|
|
return (Pixastic.Client.hasCanvasImageData() || Pixastic.Client.isIE());
|
|
}
|
|
}/*
|
|
* Pixastic Lib - Blur Fast - v0.1.1
|
|
* Copyright (c) 2008 Jacob Seidelin, jseidelin@nihilogic.dk, http://blog.nihilogic.dk/
|
|
* License: [http://www.pixastic.com/lib/license.txt]
|
|
*/
|
|
|
|
Pixastic.Actions.blurfast = {
|
|
process : function(params) {
|
|
|
|
var amount = parseFloat(params.options.amount)||0;
|
|
var clear = !!(params.options.clear && params.options.clear != "false");
|
|
|
|
amount = Math.max(0,Math.min(5,amount));
|
|
|
|
if (Pixastic.Client.hasCanvas()) {
|
|
var rect = params.options.rect;
|
|
|
|
var ctx = params.canvas.getContext("2d");
|
|
ctx.save();
|
|
ctx.beginPath();
|
|
ctx.rect(rect.left, rect.top, rect.width, rect.height);
|
|
ctx.clip();
|
|
|
|
var scale = 2;
|
|
var smallWidth = Math.round(params.width / scale);
|
|
var smallHeight = Math.round(params.height / scale);
|
|
|
|
var copy = document.createElement("canvas");
|
|
copy.width = smallWidth;
|
|
copy.height = smallHeight;
|
|
|
|
var clear = false;
|
|
var steps = Math.round(amount * 20);
|
|
|
|
var copyCtx = copy.getContext("2d");
|
|
for (var i=0;i<steps;i++) {
|
|
var scaledWidth = Math.max(1,Math.round(smallWidth - i));
|
|
var scaledHeight = Math.max(1,Math.round(smallHeight - i));
|
|
|
|
copyCtx.clearRect(0,0,smallWidth,smallHeight);
|
|
|
|
copyCtx.drawImage(
|
|
params.canvas,
|
|
0,0,params.width,params.height,
|
|
0,0,scaledWidth,scaledHeight
|
|
);
|
|
|
|
if (clear)
|
|
ctx.clearRect(rect.left,rect.top,rect.width,rect.height);
|
|
|
|
ctx.drawImage(
|
|
copy,
|
|
0,0,scaledWidth,scaledHeight,
|
|
0,0,params.width,params.height
|
|
);
|
|
}
|
|
|
|
ctx.restore();
|
|
|
|
params.useData = false;
|
|
return true;
|
|
} else if (Pixastic.Client.isIE()) {
|
|
var radius = 10 * amount;
|
|
params.image.style.filter += " progid:DXImageTransform.Microsoft.Blur(pixelradius=" + radius + ")";
|
|
|
|
if (params.options.fixMargin || 1) {
|
|
params.image.style.marginLeft = (parseInt(params.image.style.marginLeft,10)||0) - Math.round(radius) + "px";
|
|
params.image.style.marginTop = (parseInt(params.image.style.marginTop,10)||0) - Math.round(radius) + "px";
|
|
}
|
|
|
|
return true;
|
|
}
|
|
},
|
|
checkSupport : function() {
|
|
return (Pixastic.Client.hasCanvas() || Pixastic.Client.isIE());
|
|
}
|
|
}
|
|
|
|
/*********************************************************************************************************************************/
|
|
|
|
/*
|
|
* jQuery Nivo Slider v2.6
|
|
* http://nivo.dev7studios.com
|
|
*
|
|
* Copyright 2011, Gilbert Pellegrom
|
|
* Free to use and abuse under the MIT license.
|
|
* http://www.opensource.org/licenses/mit-license.php
|
|
*
|
|
* March 2010
|
|
*/
|
|
|
|
jQuery(document).ready( function($) {
|
|
|
|
var NivoSlider = function(element, options){
|
|
//Defaults are below
|
|
var settings = $.extend({}, $.fn.nivoSlider.defaults, options);
|
|
|
|
//Useful variables. Play carefully.
|
|
var vars = {
|
|
currentSlide: 0,
|
|
currentImage: '',
|
|
totalSlides: 0,
|
|
randAnim: '',
|
|
running: false,
|
|
paused: false,
|
|
stop: true
|
|
};
|
|
|
|
if(settings.autoslide == true) {
|
|
vars.stop = false;
|
|
}
|
|
|
|
//Get this slider
|
|
var slider = $(element);
|
|
slider.data('nivo:vars', vars);
|
|
slider.css('position','relative');
|
|
slider.addClass('nivoSlider');
|
|
|
|
//Find our slider children
|
|
var kids = slider.children();
|
|
kids.each(function() {
|
|
var child = $(this);
|
|
var link = '';
|
|
if(!child.is('img')){
|
|
if(child.is('a')){
|
|
child.addClass('nivo-imageLink');
|
|
link = child;
|
|
}
|
|
child = child.find('img:first');
|
|
}
|
|
//Get img width & height
|
|
var childWidth = child.width();
|
|
if(childWidth == 0) childWidth = child.attr('width');
|
|
var childHeight = child.height();
|
|
if(childHeight == 0) childHeight = child.attr('height');
|
|
//Resize the slider
|
|
if(childWidth > slider.width()){
|
|
slider.width(childWidth);
|
|
}
|
|
if(childHeight > slider.height()){
|
|
slider.height(childHeight);
|
|
}
|
|
if(link != ''){
|
|
link.css('display','none');
|
|
}
|
|
child.css('display','none');
|
|
vars.totalSlides++;
|
|
});
|
|
|
|
//Set startSlide
|
|
if(settings.startSlide > 0){
|
|
if(settings.startSlide >= vars.totalSlides) settings.startSlide = vars.totalSlides - 1;
|
|
vars.currentSlide = settings.startSlide;
|
|
}
|
|
|
|
//Get initial image
|
|
if($(kids[vars.currentSlide]).is('img')){
|
|
vars.currentImage = $(kids[vars.currentSlide]);
|
|
} else {
|
|
vars.currentImage = $(kids[vars.currentSlide]).find('img:first');
|
|
}
|
|
|
|
//Show initial link
|
|
if($(kids[vars.currentSlide]).is('a')){
|
|
$(kids[vars.currentSlide]).css('display','block');
|
|
}
|
|
|
|
//Set first background
|
|
slider.css('background-image','url("'+ vars.currentImage.attr('src') +'")', 'background-repeat', 'no-repeat');
|
|
|
|
//Create caption
|
|
slider.append(
|
|
$('<div class="nivo-caption"></div>').css({ display:'none', opacity:settings.captionOpacity })
|
|
);
|
|
|
|
slider.append(
|
|
$('<div class="link nivo-link"><a href="" target=""></a></div>').css({ display:'none', "z-index": "999"})
|
|
);
|
|
|
|
// Process caption function
|
|
var processCaption = function(settings) {
|
|
var nivoCaption = $('.nivo-caption', slider),
|
|
nivoLink = $('.nivo-link > a', slider);
|
|
|
|
var theLink = vars.currentImage.attr('data-link');
|
|
|
|
if (theLink) {
|
|
nivoLink.attr('href', theLink);
|
|
|
|
if(vars.currentImage.attr('title') != '' && vars.currentImage.attr('title') != undefined){
|
|
nivoLink.parent(".nivo-link").fadeOut(settings.animSpeed);
|
|
} else {
|
|
nivoLink.parent(".nivo-link").fadeOut(settings.animSpeed, function() {
|
|
nivoLink.parent(".nivo-link").delay(settings.animSpeed).fadeIn(settings.animSpeed);
|
|
});
|
|
}
|
|
} else {
|
|
nivoLink.parent(".nivo-link").fadeOut(settings.animSpeed);
|
|
}
|
|
|
|
if(vars.currentImage.attr('title') != '' && vars.currentImage.attr('title') != undefined){
|
|
var title = vars.currentImage.attr('title');
|
|
var has_that_class = false;
|
|
|
|
|
|
if(title.substr(0,1) == '.' || title.substr(0,1) == '#') {
|
|
title = slider.parent().find(title);
|
|
has_that_class = title.hasClass('no-slide-desc');
|
|
title = title.html();
|
|
}
|
|
|
|
if(nivoCaption.css('display') == 'block'){
|
|
nivoCaption.fadeOut(settings.animSpeed, function(){
|
|
$(this).html(title);
|
|
$(this).delay(settings.animSpeed).fadeIn(settings.animSpeed);
|
|
if (theLink) nivoLink.parent(".nivo-link").delay(settings.animSpeed).fadeIn(settings.animSpeed);
|
|
|
|
});
|
|
} else {
|
|
nivoCaption.html(title);
|
|
nivoCaption.delay(settings.animSpeed).fadeIn(settings.animSpeed);
|
|
if (theLink) nivoLink.parent(".nivo-link").delay(settings.animSpeed).fadeIn(settings.animSpeed);
|
|
}
|
|
|
|
if( has_that_class ) {
|
|
nivoCaption.addClass('no-slide-desc');
|
|
}else {
|
|
nivoCaption.removeClass('no-slide-desc');
|
|
}
|
|
|
|
} else {
|
|
nivoCaption.fadeOut(settings.animSpeed);
|
|
}
|
|
}
|
|
|
|
//Process initial caption
|
|
processCaption(settings);
|
|
|
|
//In the words of Super Mario "let's a go!"
|
|
var timer = 0;
|
|
if(!settings.manualAdvance && kids.length > 1){
|
|
timer = setInterval(function(){ nivoRun(slider, kids, settings, false); }, settings.pauseTime);
|
|
}
|
|
|
|
//Add Direction nav
|
|
if(settings.directionNav || settings.customNav){
|
|
if(settings.directionNav){
|
|
slider.append('<div class="nivo-directionNav"><a class="nivo-prevNav">'+ settings.prevText +'</a><a class="nivo-nextNav">'+ settings.nextText +'</a></div>');
|
|
|
|
//Hide Direction nav
|
|
if(settings.directionNavHide){
|
|
$('.nivo-directionNav', slider).hide();
|
|
slider.hover(function(){
|
|
$('.nivo-directionNav', slider).show();
|
|
}, function(){
|
|
$('.nivo-directionNav', slider).hide();
|
|
});
|
|
}
|
|
|
|
$('.nivo-prevNav', slider).on('click', function(){
|
|
if(vars.running) return false;
|
|
clearInterval(timer);
|
|
timer = '';
|
|
vars.currentSlide -= 2;
|
|
nivoRun(slider, kids, settings, 'prev');
|
|
});
|
|
|
|
$('.nivo-nextNav', slider).on('click', function(){
|
|
if(vars.running) return false;
|
|
clearInterval(timer);
|
|
timer = '';
|
|
nivoRun(slider, kids, settings, 'next');
|
|
});
|
|
$('#slider.nivoSlider').touchwipe({
|
|
wipeLeft: function() { $('.nivo-nextNav', slider).trigger("click"); },
|
|
wipeRight: function() { $('.nivo-prevNav', slider).trigger("click"); },
|
|
min_move_x: 30,
|
|
min_move_y: 20,
|
|
preventDefaultEvents: false,
|
|
dtPreventX: true
|
|
});
|
|
|
|
} else {
|
|
|
|
$(settings.customNavPrev).on('click', function(){
|
|
if(vars.running) return false;
|
|
clearInterval(timer);
|
|
timer = '';
|
|
vars.currentSlide -= 2;
|
|
nivoRun(slider, kids, settings, 'prev');
|
|
});
|
|
|
|
$(settings.customNavNext).on('click', function(){
|
|
if(vars.running) return false;
|
|
clearInterval(timer);
|
|
timer = '';
|
|
nivoRun(slider, kids, settings, 'next');
|
|
});
|
|
$('#slider.nivoSlider').touchwipe({
|
|
wipeLeft: function() { $(settings.customNavNext).trigger("click"); },
|
|
wipeRight: function() { $(settings.customNavPrev).trigger("click"); },
|
|
min_move_x: 30,
|
|
min_move_y: 20,
|
|
preventDefaultEvents: false,
|
|
dtPreventX: true
|
|
});
|
|
|
|
$(settings.customNavPrev_w).on('click', function(){
|
|
if(vars.running) return false;
|
|
clearInterval(timer);
|
|
timer = '';
|
|
vars.currentSlide -= 2;
|
|
nivoRun(slider, kids, settings, 'prev');
|
|
});
|
|
|
|
$(settings.customNavNext_w).on('click', function(){
|
|
if(vars.running) return false;
|
|
clearInterval(timer);
|
|
timer = '';
|
|
nivoRun(slider, kids, settings, 'next');
|
|
});
|
|
$('.widget_slider.nivoSlider').touchwipe({
|
|
wipeLeft: function() { $(settings.customNavNext_w).trigger("click"); },
|
|
wipeRight: function() { $(settings.customNavPrev_w).trigger("click"); },
|
|
min_move_x: 30,
|
|
min_move_y: 20,
|
|
preventDefaultEvents: false,
|
|
dtPreventX: true
|
|
});
|
|
}
|
|
}
|
|
|
|
//Add Control nav
|
|
if(settings.controlNav){
|
|
var nivoControl = $('<div class="nivo-controlNav"></div>');
|
|
slider.append(nivoControl);
|
|
for(var i = 0; i < kids.length; i++){
|
|
if(settings.controlNavThumbs){
|
|
var child = kids.eq(i);
|
|
if(!child.is('img')){
|
|
child = child.find('img:first');
|
|
}
|
|
if (settings.controlNavThumbsFromRel) {
|
|
nivoControl.append('<a class="nivo-control" rel="'+ i +'"><img src="'+ child.attr('rel') + '" alt="" /></a>');
|
|
} else {
|
|
nivoControl.append('<a class="nivo-control" rel="'+ i +'"><img src="'+ child.attr('src').replace(settings.controlNavThumbsSearch, settings.controlNavThumbsReplace) +'" alt="" /></a>');
|
|
}
|
|
} else {
|
|
nivoControl.append('<a class="nivo-control" rel="'+ i +'">'+ (i + 1) +'</a>');
|
|
}
|
|
|
|
}
|
|
//Set initial active link
|
|
$('.nivo-controlNav a:eq('+ vars.currentSlide +')', slider).addClass('active');
|
|
|
|
$('.nivo-controlNav a', slider).on('click', function(){
|
|
if(vars.running) return false;
|
|
if($(this).hasClass('active')) return false;
|
|
clearInterval(timer);
|
|
timer = '';
|
|
slider.css('background-image','url("'+ vars.currentImage.attr('src') +'")', 'background-repeat', 'no-repeat');
|
|
vars.currentSlide = $(this).attr('rel') - 1;
|
|
nivoRun(slider, kids, settings, 'control');
|
|
});
|
|
}
|
|
|
|
//Keyboard Navigation
|
|
if(settings.keyboardNav){
|
|
$(window).keypress(function(event){
|
|
//Left
|
|
if(event.keyCode == '37'){
|
|
if(vars.running) return false;
|
|
clearInterval(timer);
|
|
timer = '';
|
|
vars.currentSlide-=2;
|
|
nivoRun(slider, kids, settings, 'prev');
|
|
}
|
|
//Right
|
|
if(event.keyCode == '39'){
|
|
if(vars.running) return false;
|
|
clearInterval(timer);
|
|
timer = '';
|
|
nivoRun(slider, kids, settings, 'next');
|
|
}
|
|
});
|
|
}
|
|
|
|
//For pauseOnHover setting
|
|
if(settings.pauseOnHover){
|
|
slider.hover(function(){
|
|
vars.paused = true;
|
|
clearInterval(timer);
|
|
timer = '';
|
|
}, function(){
|
|
vars.paused = false;
|
|
//Restart the timer
|
|
if(timer == '' && !settings.manualAdvance){
|
|
timer = setInterval(function(){ nivoRun(slider, kids, settings, false); }, settings.pauseTime);
|
|
}
|
|
});
|
|
}
|
|
|
|
//Event when Animation finishes
|
|
slider.bind('nivo:animFinished', function(){
|
|
vars.running = false;
|
|
//Hide child links
|
|
$(kids).each(function(){
|
|
if($(this).is('a')){
|
|
$(this).css('display','none');
|
|
}
|
|
});
|
|
//Show current link
|
|
if($(kids[vars.currentSlide]).is('a')){
|
|
$(kids[vars.currentSlide]).css('display','block');
|
|
}
|
|
//Restart the timer
|
|
if(timer == '' && !vars.paused && !settings.manualAdvance){
|
|
timer = setInterval(function(){ nivoRun(slider, kids, settings, false); }, settings.pauseTime);
|
|
}
|
|
//Trigger the afterChange callback
|
|
settings.afterChange.call(this);
|
|
});
|
|
|
|
// Add slices for slice animations
|
|
var createSlices = function(slider, settings, vars){
|
|
for(var i = 0; i < settings.slices; i++){
|
|
var sliceWidth = Math.round(slider.width()/settings.slices);
|
|
if(i == settings.slices-1){
|
|
slider.append(
|
|
$('<div class="nivo-slice"></div>').css({
|
|
left:(sliceWidth*i)+'px', width:(slider.width()-(sliceWidth*i))+'px',
|
|
height:'0px',
|
|
opacity:'0',
|
|
'background-image': 'url("'+ vars.currentImage.attr('src') +'")',
|
|
'background-repeat': 'no-repeat',
|
|
'background-position': '-'+ ((sliceWidth + (i * sliceWidth)) - sliceWidth) +'px 0%'
|
|
})
|
|
);
|
|
} else {
|
|
slider.append(
|
|
$('<div class="nivo-slice"></div>').css({
|
|
left:(sliceWidth*i)+'px', width:sliceWidth+'px',
|
|
height:'0px',
|
|
opacity:'0',
|
|
'background-image': 'url("'+ vars.currentImage.attr('src') +'")',
|
|
'background-repeat': 'no-repeat',
|
|
'background-position': '-'+ ((sliceWidth + (i * sliceWidth)) - sliceWidth) +'px 0%'
|
|
})
|
|
);
|
|
}
|
|
}
|
|
}
|
|
|
|
// Add boxes for box animations
|
|
var createBoxes = function(slider, settings, vars){
|
|
var boxWidth = Math.round(slider.width()/settings.boxCols);
|
|
var boxHeight = Math.round(slider.height()/settings.boxRows);
|
|
|
|
for(var rows = 0; rows < settings.boxRows; rows++){
|
|
for(var cols = 0; cols < settings.boxCols; cols++){
|
|
if(cols == settings.boxCols-1){
|
|
slider.append(
|
|
$('<div class="nivo-box"></div>').css({
|
|
opacity:0,
|
|
left:(boxWidth*cols)+'px',
|
|
top:(boxHeight*rows)+'px',
|
|
width:(slider.width()-(boxWidth*cols))+'px',
|
|
height:boxHeight+'px',
|
|
'background-image': 'url("'+ vars.currentImage.attr('src') +'")',
|
|
'background-repeat': 'no-repeat',
|
|
'background-position': '-'+ ((boxWidth + (cols * boxWidth)) - boxWidth) +'px -'+ ((boxHeight + (rows * boxHeight)) - boxHeight) +'px'
|
|
})
|
|
);
|
|
|
|
|
|
} else {
|
|
slider.append(
|
|
$('<div class="nivo-box"></div>').css({
|
|
opacity:0,
|
|
left:(boxWidth*cols)+'px',
|
|
top:(boxHeight*rows)+'px',
|
|
width:boxWidth+'px',
|
|
height:boxHeight+'px',
|
|
'background-image': 'url("'+ vars.currentImage.attr('src') +'")',
|
|
'background-repeat': 'no-repeat',
|
|
'background-position': '-'+ ((boxWidth + (cols * boxWidth)) - boxWidth) +'px -'+ ((boxHeight + (rows * boxHeight)) - boxHeight) +'px'
|
|
})
|
|
);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
// Private run method
|
|
var nivoRun = function(slider, kids, settings, nudge){
|
|
|
|
//Get our vars
|
|
var vars = slider.data('nivo:vars');
|
|
|
|
//Trigger the lastSlide callback
|
|
if(vars && (vars.currentSlide == vars.totalSlides - 1)){
|
|
settings.lastSlide.call(this);
|
|
}
|
|
|
|
// Stop
|
|
if((!vars || vars.stop) && !nudge) return false;
|
|
|
|
//Trigger the beforeChange callback
|
|
settings.beforeChange.call(this);
|
|
|
|
//Set current background before change
|
|
if(!nudge){
|
|
slider.css('background-image','url("'+ vars.currentImage.attr('src') +'")', 'background-repeat', 'no-repeat');
|
|
} else {
|
|
if(nudge == 'prev'){
|
|
slider.css('background-image','url("'+ vars.currentImage.attr('src') +'")', 'background-repeat', 'no-repeat');
|
|
}
|
|
if(nudge == 'next'){
|
|
slider.css('background-image','url("'+ vars.currentImage.attr('src') +'")', 'background-repeat', 'no-repeat');
|
|
}
|
|
}
|
|
vars.currentSlide++;
|
|
//Trigger the slideshowEnd callback
|
|
if(vars.currentSlide == vars.totalSlides){
|
|
vars.currentSlide = 0;
|
|
settings.slideshowEnd.call(this);
|
|
}
|
|
if(vars.currentSlide < 0) vars.currentSlide = (vars.totalSlides - 1);
|
|
//Set vars.currentImage
|
|
if($(kids[vars.currentSlide]).is('img')){
|
|
vars.currentImage = $(kids[vars.currentSlide]);
|
|
} else {
|
|
vars.currentImage = $(kids[vars.currentSlide]).find('img:first');
|
|
}
|
|
|
|
//Set active links
|
|
if(settings.controlNav){
|
|
$('.nivo-controlNav a', slider).removeClass('active');
|
|
$('.nivo-controlNav a:eq('+ vars.currentSlide +')', slider).addClass('active');
|
|
}
|
|
|
|
//Process caption
|
|
processCaption(settings);
|
|
|
|
// Remove any slices from last transition
|
|
$('.nivo-slice', slider).remove();
|
|
|
|
// Remove any boxes from last transition
|
|
$('.nivo-box', slider).remove();
|
|
|
|
if(settings.effect == 'random'){
|
|
var anims = new Array('sliceDownRight','sliceDownLeft','sliceUpRight','sliceUpLeft','sliceUpDown','sliceUpDownLeft','fold','fade',
|
|
'boxRandom','boxRain','boxRainReverse','boxRainGrow','boxRainGrowReverse');
|
|
vars.randAnim = anims[Math.floor(Math.random()*(anims.length + 1))];
|
|
if(vars.randAnim == undefined) vars.randAnim = 'fade';
|
|
}
|
|
|
|
//Run random effect from specified set (eg: effect:'fold,fade')
|
|
if(settings.effect.indexOf(',') != -1){
|
|
var anims = settings.effect.split(',');
|
|
vars.randAnim = anims[Math.floor(Math.random()*(anims.length))];
|
|
if(vars.randAnim == undefined) vars.randAnim = 'fade';
|
|
}
|
|
|
|
//Run effects
|
|
vars.running = true;
|
|
if(settings.effect == 'sliceDown' || settings.effect == 'sliceDownRight' || vars.randAnim == 'sliceDownRight' ||
|
|
settings.effect == 'sliceDownLeft' || vars.randAnim == 'sliceDownLeft'){
|
|
createSlices(slider, settings, vars);
|
|
var timeBuff = 0;
|
|
var i = 0;
|
|
var slices = $('.nivo-slice', slider);
|
|
if(settings.effect == 'sliceDownLeft' || vars.randAnim == 'sliceDownLeft') slices = $('.nivo-slice', slider)._reverse();
|
|
|
|
slices.each(function(){
|
|
var slice = $(this);
|
|
slice.css({ 'top': '0px' });
|
|
if(i == settings.slices-1){
|
|
setTimeout(function(){
|
|
slice.animate({ height:'100%', opacity:'1.0' }, settings.animSpeed, '', function(){ slider.trigger('nivo:animFinished'); });
|
|
}, (100 + timeBuff));
|
|
} else {
|
|
setTimeout(function(){
|
|
slice.animate({ height:'100%', opacity:'1.0' }, settings.animSpeed);
|
|
}, (100 + timeBuff));
|
|
}
|
|
timeBuff += 50;
|
|
i++;
|
|
});
|
|
}
|
|
else if(settings.effect == 'sliceUp' || settings.effect == 'sliceUpRight' || vars.randAnim == 'sliceUpRight' ||
|
|
settings.effect == 'sliceUpLeft' || vars.randAnim == 'sliceUpLeft'){
|
|
createSlices(slider, settings, vars);
|
|
var timeBuff = 0;
|
|
var i = 0;
|
|
var slices = $('.nivo-slice', slider);
|
|
if(settings.effect == 'sliceUpLeft' || vars.randAnim == 'sliceUpLeft') slices = $('.nivo-slice', slider)._reverse();
|
|
|
|
slices.each(function(){
|
|
var slice = $(this);
|
|
slice.css({ 'bottom': '0px' });
|
|
if(i == settings.slices-1){
|
|
setTimeout(function(){
|
|
slice.animate({ height:'100%', opacity:'1.0' }, settings.animSpeed, '', function(){ slider.trigger('nivo:animFinished'); });
|
|
}, (100 + timeBuff));
|
|
} else {
|
|
setTimeout(function(){
|
|
slice.animate({ height:'100%', opacity:'1.0' }, settings.animSpeed);
|
|
}, (100 + timeBuff));
|
|
}
|
|
timeBuff += 50;
|
|
i++;
|
|
});
|
|
}
|
|
else if(settings.effect == 'sliceUpDown' || settings.effect == 'sliceUpDownRight' || vars.randAnim == 'sliceUpDown' ||
|
|
settings.effect == 'sliceUpDownLeft' || vars.randAnim == 'sliceUpDownLeft'){
|
|
createSlices(slider, settings, vars);
|
|
var timeBuff = 0;
|
|
var i = 0;
|
|
var v = 0;
|
|
var slices = $('.nivo-slice', slider);
|
|
if(settings.effect == 'sliceUpDownLeft' || vars.randAnim == 'sliceUpDownLeft') slices = $('.nivo-slice', slider)._reverse();
|
|
|
|
slices.each(function(){
|
|
var slice = $(this);
|
|
if(i == 0){
|
|
slice.css('top','0px');
|
|
i++;
|
|
} else {
|
|
slice.css('bottom','0px');
|
|
i = 0;
|
|
}
|
|
|
|
if(v == settings.slices-1){
|
|
setTimeout(function(){
|
|
slice.animate({ height:'100%', opacity:'1.0' }, settings.animSpeed, '', function(){ slider.trigger('nivo:animFinished'); });
|
|
}, (100 + timeBuff));
|
|
} else {
|
|
setTimeout(function(){
|
|
slice.animate({ height:'100%', opacity:'1.0' }, settings.animSpeed);
|
|
}, (100 + timeBuff));
|
|
}
|
|
timeBuff += 50;
|
|
v++;
|
|
});
|
|
}
|
|
else if(settings.effect == 'fold' || vars.randAnim == 'fold'){
|
|
createSlices(slider, settings, vars);
|
|
var timeBuff = 0;
|
|
var i = 0;
|
|
|
|
$('.nivo-slice', slider).each(function(){
|
|
var slice = $(this);
|
|
var origWidth = slice.width();
|
|
slice.css({ top:'0px', height:'100%', width:'0px' });
|
|
if(i == settings.slices-1){
|
|
setTimeout(function(){
|
|
slice.animate({ width:origWidth, opacity:'1.0' }, settings.animSpeed, '', function(){ slider.trigger('nivo:animFinished'); });
|
|
}, (100 + timeBuff));
|
|
} else {
|
|
setTimeout(function(){
|
|
slice.animate({ width:origWidth, opacity:'1.0' }, settings.animSpeed);
|
|
}, (100 + timeBuff));
|
|
}
|
|
timeBuff += 50;
|
|
i++;
|
|
});
|
|
}
|
|
else if(settings.effect == 'fade' || vars.randAnim == 'fade'){
|
|
createSlices(slider, settings, vars);
|
|
|
|
var firstSlice = $('.nivo-slice:first', slider);
|
|
firstSlice.css({
|
|
'height': '100%',
|
|
'width': slider.width() + 'px'
|
|
});
|
|
|
|
firstSlice.animate({ opacity:'1.0' }, (settings.animSpeed*2), '', function(){ slider.trigger('nivo:animFinished'); });
|
|
}
|
|
else if(settings.effect == 'slideInRight' || vars.randAnim == 'slideInRight'){
|
|
createSlices(slider, settings, vars);
|
|
|
|
var firstSlice = $('.nivo-slice:first', slider);
|
|
firstSlice.css({
|
|
'height': '100%',
|
|
'width': '0px',
|
|
'opacity': '1'
|
|
});
|
|
|
|
firstSlice.animate({ width: slider.width() + 'px' }, (settings.animSpeed*2), '', function(){ slider.trigger('nivo:animFinished'); });
|
|
}
|
|
else if(settings.effect == 'slideInLeft' || vars.randAnim == 'slideInLeft'){
|
|
createSlices(slider, settings, vars);
|
|
|
|
var firstSlice = $('.nivo-slice:first', slider);
|
|
firstSlice.css({
|
|
'height': '100%',
|
|
'width': '0px',
|
|
'opacity': '1',
|
|
'left': '',
|
|
'right': '0px'
|
|
});
|
|
|
|
firstSlice.animate({ width: slider.width() + 'px' }, (settings.animSpeed*2), '', function(){
|
|
// Reset positioning
|
|
firstSlice.css({
|
|
'left': '0px',
|
|
'right': ''
|
|
});
|
|
slider.trigger('nivo:animFinished');
|
|
});
|
|
}
|
|
else if(settings.effect == 'boxRandom' || vars.randAnim == 'boxRandom'){
|
|
createBoxes(slider, settings, vars);
|
|
|
|
var totalBoxes = settings.boxCols * settings.boxRows;
|
|
var i = 0;
|
|
var timeBuff = 0;
|
|
|
|
var boxes = shuffle($('.nivo-box', slider));
|
|
boxes.each(function(){
|
|
var box = $(this);
|
|
if(i == totalBoxes-1){
|
|
setTimeout(function(){
|
|
box.animate({ opacity:'1' }, settings.animSpeed, '', function(){ slider.trigger('nivo:animFinished'); });
|
|
}, (100 + timeBuff));
|
|
} else {
|
|
setTimeout(function(){
|
|
box.animate({ opacity:'1' }, settings.animSpeed);
|
|
}, (100 + timeBuff));
|
|
}
|
|
timeBuff += 20;
|
|
i++;
|
|
});
|
|
}
|
|
else if(settings.effect == 'boxRain' || vars.randAnim == 'boxRain' || settings.effect == 'boxRainReverse' || vars.randAnim == 'boxRainReverse' ||
|
|
settings.effect == 'boxRainGrow' || vars.randAnim == 'boxRainGrow' || settings.effect == 'boxRainGrowReverse' || vars.randAnim == 'boxRainGrowReverse'){
|
|
createBoxes(slider, settings, vars);
|
|
|
|
var totalBoxes = settings.boxCols * settings.boxRows;
|
|
var i = 0;
|
|
var timeBuff = 0;
|
|
|
|
// Split boxes into 2D array
|
|
var rowIndex = 0;
|
|
var colIndex = 0;
|
|
var box2Darr = new Array();
|
|
box2Darr[rowIndex] = new Array();
|
|
var boxes = $('.nivo-box', slider);
|
|
if(settings.effect == 'boxRainReverse' || vars.randAnim == 'boxRainReverse' ||
|
|
settings.effect == 'boxRainGrowReverse' || vars.randAnim == 'boxRainGrowReverse'){
|
|
boxes = $('.nivo-box', slider)._reverse();
|
|
}
|
|
boxes.each(function(){
|
|
box2Darr[rowIndex][colIndex] = $(this);
|
|
colIndex++;
|
|
if(colIndex == settings.boxCols){
|
|
rowIndex++;
|
|
colIndex = 0;
|
|
box2Darr[rowIndex] = new Array();
|
|
}
|
|
});
|
|
|
|
// Run animation
|
|
for(var cols = 0; cols < (settings.boxCols * 2); cols++){
|
|
var prevCol = cols;
|
|
for(var rows = 0; rows < settings.boxRows; rows++){
|
|
if(prevCol >= 0 && prevCol < settings.boxCols){
|
|
/* Due to some weird JS bug with loop vars
|
|
being used in setTimeout, this is wrapped
|
|
with an anonymous function call */
|
|
(function(row, col, time, i, totalBoxes) {
|
|
var box = $(box2Darr[row][col]);
|
|
var w = box.width();
|
|
var h = box.height();
|
|
if(settings.effect == 'boxRainGrow' || vars.randAnim == 'boxRainGrow' ||
|
|
settings.effect == 'boxRainGrowReverse' || vars.randAnim == 'boxRainGrowReverse'){
|
|
box.width(0).height(0);
|
|
}
|
|
if(i == totalBoxes-1){
|
|
setTimeout(function(){
|
|
box.animate({ opacity:'1', width:w, height:h }, settings.animSpeed/1.3, '', function(){ slider.trigger('nivo:animFinished'); });
|
|
}, (100 + time));
|
|
} else {
|
|
setTimeout(function(){
|
|
box.animate({ opacity:'1', width:w, height:h }, settings.animSpeed/1.3);
|
|
}, (100 + time));
|
|
}
|
|
})(rows, prevCol, timeBuff, i, totalBoxes);
|
|
i++;
|
|
}
|
|
prevCol--;
|
|
}
|
|
timeBuff += 100;
|
|
}
|
|
}
|
|
}
|
|
|
|
// Shuffle an array
|
|
var shuffle = function(arr){
|
|
for(var j, x, i = arr.length; i; j = parseInt(Math.random() * i), x = arr[--i], arr[i] = arr[j], arr[j] = x);
|
|
return arr;
|
|
}
|
|
|
|
// For debugging
|
|
var trace = function(msg){
|
|
if (this.console && typeof console.log != "undefined")
|
|
console.log(msg);
|
|
}
|
|
|
|
// Start / Stop
|
|
this.stop = function(){
|
|
if(!$(element).data('nivo:vars').stop){
|
|
$(element).data('nivo:vars').stop = true;
|
|
trace('Stop Slider');
|
|
}
|
|
}
|
|
|
|
this.start = function(){
|
|
if($(element).data('nivo:vars').stop){
|
|
$(element).data('nivo:vars').stop = false;
|
|
trace('Start Slider');
|
|
}
|
|
}
|
|
|
|
//Trigger the afterLoad callback
|
|
settings.afterLoad.call(this);
|
|
|
|
return this;
|
|
};
|
|
|
|
$.fn.nivoSlider = function(options) {
|
|
|
|
return this.each(function(key, value){
|
|
var element = $(this);
|
|
// Return early if this element already has a plugin instance
|
|
if (element.data('nivoslider')) return element.data('nivoslider');
|
|
// Pass options to plugin constructor
|
|
var nivoslider = new NivoSlider(this, options);
|
|
// Store plugin object in this element's data
|
|
element.data('nivoslider', nivoslider);
|
|
});
|
|
|
|
};
|
|
|
|
//Default settings
|
|
$.fn.nivoSlider.defaults = {
|
|
effect: 'random',
|
|
slices: 15,
|
|
boxCols: 8,
|
|
boxRows: 4,
|
|
animSpeed: 500,
|
|
pauseTime: 3000,
|
|
startSlide: 0,
|
|
directionNav: true,
|
|
customNav: false,
|
|
customNavPrev: '',
|
|
customNavNext: '',
|
|
|
|
customNavPrev_w: '',
|
|
customNavNext_w: '',
|
|
|
|
directionNavHide: true,
|
|
controlNav: true,
|
|
controlNavThumbs: false,
|
|
controlNavThumbsFromRel: false,
|
|
controlNavThumbsSearch: '.jpg',
|
|
controlNavThumbsReplace: '_thumb.jpg',
|
|
keyboardNav: true,
|
|
pauseOnHover: true,
|
|
manualAdvance: false,
|
|
captionOpacity:1,
|
|
prevText: 'Prev',
|
|
nextText: 'Next',
|
|
|
|
beforeChange: function(){},
|
|
afterChange: function(){},
|
|
slideshowEnd: function(){},
|
|
lastSlide: function(){},
|
|
afterLoad: function(){}
|
|
};
|
|
|
|
$.fn._reverse = [].reverse;
|
|
|
|
});
|
|
/*********************************************************************************************************************************/
|
|
|
|
/**
|
|
* Due to bugs of jquert.touchwipe plugin on iOS 6 it was changed to cutom code partly taken from jquery.touchslider (http://touchslider.com)
|
|
*/
|
|
|
|
(function($) {
|
|
$.fn.touchwipe = function(settings) {
|
|
var config = {
|
|
min_move_x: 20,
|
|
min_move_y: 20,
|
|
wipeLeft: function() { },
|
|
wipeRight: function() { },
|
|
wipeUp: function() { },
|
|
wipeDown: function() { },
|
|
preventDefaultEvents: true,
|
|
dtPreventX: false
|
|
};
|
|
|
|
if (settings) $.extend(config, settings);
|
|
|
|
this.each(function() {
|
|
|
|
var viewport = $(this),
|
|
namespace = "dtTouch",
|
|
touchstart = "touchstart",
|
|
touchmove = "touchmove",
|
|
touchend = "touchend",
|
|
minSwipe = 80;
|
|
|
|
var doc = $(document),
|
|
startTime,
|
|
defaultPrevented,
|
|
moving = false, // if mouseup in stopPropogation area
|
|
startPageX,
|
|
previousPageX,
|
|
distX,
|
|
absDistX,
|
|
startPageY,
|
|
previousPageY,
|
|
distY,
|
|
absDistY,
|
|
|
|
start = function(e) {
|
|
if (e.which > 1) {
|
|
return;
|
|
}
|
|
|
|
if (moving) {
|
|
doc.triggerHandler(touchend + "." + namespace);
|
|
}
|
|
|
|
moving = true;
|
|
defaultPrevented = false,
|
|
startTime = e.timeStamp;
|
|
distX = distY = 0;
|
|
|
|
times = [0, 0, 0, startTime];
|
|
|
|
// delegate to document for coorect touches length
|
|
if (e.originalEvent.touches) {
|
|
doc.one(touchstart, touchStart);
|
|
return;
|
|
}
|
|
|
|
// no drag images
|
|
e.preventDefault();
|
|
|
|
startPageX = previousPageX = e.pageX;
|
|
startPageY = previousPageY = e.pageY;
|
|
|
|
coords = [0, 0, 0, startPageX];
|
|
|
|
doc.bind(touchmove, move);
|
|
doc.one(touchend + "." + namespace, end);
|
|
},
|
|
|
|
touchStart = function(e) {
|
|
if (e.originalEvent.touches.length !== 1) {
|
|
return;
|
|
}
|
|
|
|
startPageX = previousPageX = e.pageX = e.originalEvent.touches[0].pageX;
|
|
startPageY = previousPageY = e.pageY = e.originalEvent.touches[0].pageY;
|
|
absDistX = absDistY = 0;
|
|
|
|
coords = [0, 0, 0, startPageX];
|
|
|
|
doc.bind(touchmove, move);
|
|
doc.one(touchend, end);
|
|
|
|
//switching.moveStart(e);
|
|
},
|
|
|
|
move = function(e) {
|
|
var pageX, pageY;
|
|
|
|
if (e.originalEvent.touches) {
|
|
if (e.originalEvent.touches.length !== 1) {
|
|
return;
|
|
}
|
|
|
|
pageX = e.pageX = e.originalEvent.touches[0].pageX;
|
|
pageY = e.pageY = e.originalEvent.touches[0].pageY;
|
|
|
|
// iphone allow scrolling page
|
|
absDistX += Math.abs(pageX - previousPageX);
|
|
absDistY += Math.abs(pageY - previousPageY);
|
|
|
|
// when long touching in one direction and then want to switch
|
|
if (Math.abs(absDistX - absDistY) > 50) {
|
|
var absDistXOld = absDistX;
|
|
absDistX = Math.min(100, Math.max(0, absDistX - absDistY));
|
|
absDistY = Math.min(100, Math.max(0, absDistY - absDistXOld));
|
|
}
|
|
|
|
if (pageX === previousPageX) {
|
|
return;
|
|
}
|
|
|
|
// to scroll in a single direction
|
|
if (!defaultPrevented) {
|
|
if (absDistX > absDistY) {
|
|
e.preventDefault();
|
|
defaultPrevented = true;
|
|
} else {
|
|
end(e);
|
|
}
|
|
}
|
|
} else {
|
|
pageX = e.pageX;
|
|
pageY = e.pageY;
|
|
|
|
if (pageX === previousPageX) {
|
|
return;
|
|
}
|
|
|
|
if ($.browser.msie) {
|
|
e.preventDefault();
|
|
}
|
|
}
|
|
|
|
distX += Math.abs(pageX - previousPageX);
|
|
distY += Math.abs(pageY - previousPageY);
|
|
|
|
previousPageX = pageX;
|
|
previousPageY = pageY;
|
|
|
|
if (defaultPrevented) {
|
|
//console.log("dX: "+(startPageX - pageX));
|
|
}
|
|
|
|
},
|
|
|
|
end = function(e) {
|
|
moving = false;
|
|
// mobile webkit browser fix
|
|
if (!e.originalEvent || e.originalEvent.touches) {
|
|
e.pageX = previousPageX;
|
|
e.pageY = previousPageY;
|
|
}
|
|
doc.unbind(touchmove, move);
|
|
|
|
var dX = startPageX - e.pageX;
|
|
|
|
if ( defaultPrevented && (dX < -minSwipe) ) {
|
|
//console.log("swipe back")
|
|
config.wipeRight();
|
|
} else if ( defaultPrevented && (dX > minSwipe) ) {
|
|
//console.log("swipe forward");
|
|
config.wipeLeft();
|
|
}
|
|
|
|
if (distX + distY > 4) {
|
|
viewport.one("click", function(e) {
|
|
e.preventDefault();
|
|
});
|
|
}
|
|
};
|
|
|
|
viewport.bind(touchstart, start);
|
|
});
|
|
|
|
return this;
|
|
};
|
|
|
|
})(jQuery);
|
|
|
|
/*********************************************************************************************************************************/
|
|
|
|
/*SHORTCODES*/
|
|
jQuery(document).ready(function($){
|
|
|
|
$(window).load(function(){
|
|
|
|
$('.slider-shortcode').each(function(){
|
|
|
|
var $this = $(this),
|
|
autoslideOn = $this.attr("data-autoslide_on") || 0,
|
|
autoslideInterval = $this.attr("data-autoslide") || 7000;
|
|
|
|
if(autoslideOn == "0") {
|
|
autoslideOn = false;
|
|
} else if (autoslideOn == "1") {
|
|
autoslideOn = true;
|
|
}
|
|
|
|
$(this).fitVids().flexslider({
|
|
animation: "fade",
|
|
smoothHeight: true,
|
|
slideshow : autoslideOn,
|
|
slideshowSpeed : autoslideInterval,
|
|
start: function(slider){
|
|
$('iframe').attr('id', 'player_1');
|
|
$('.flexslider .html-caption', $_currentPage).css({
|
|
|
|
'visibility':'visible'
|
|
})
|
|
var $_currentPage = $('.flex-active-slide');
|
|
|
|
}
|
|
});
|
|
|
|
$('.flex-direction-nav').hide();
|
|
$this.hover(function(){
|
|
$('.flex-direction-nav', this).stop().fadeTo(300, 1);
|
|
},
|
|
function () {
|
|
$('.flex-direction-nav', this).stop().fadeTo(300, 0);
|
|
});
|
|
hoverArrows();
|
|
|
|
});
|
|
});
|
|
|
|
});
|
|
|
|
jQuery(document).ready(function($) {
|
|
$(".toggle").find(' a.question').on('click', function (event) {
|
|
event.preventDefault();
|
|
$(this).toggleClass("act");
|
|
$(this).next("div.answer").slideToggle("fast");
|
|
});
|
|
});
|
|
|
|
jQuery().ready(function(){
|
|
// simple accordion
|
|
jQuery('.list1a').accordion();
|
|
jQuery('.list1b').accordion({
|
|
header: 'a.accheader',
|
|
autoheight: false
|
|
});
|
|
});
|
|
|
|
/*Tabs*/
|
|
jQuery(function($) {
|
|
$(".tab").organicTabs({
|
|
"speed": 200
|
|
});
|
|
|
|
});
|
|
|
|
(function($){
|
|
/*Tooltip*/
|
|
function simple_tooltip(target_items, name){
|
|
$(target_items).each(function(i){
|
|
$("body").append("<div class='"+name+"' id='"+name+i+"'>"+$(this).find('span.tooltip_c').html()+"</div>");
|
|
var my_tooltip = $("#"+name+i);
|
|
|
|
$(this).removeAttr("title").mouseover(function(){
|
|
my_tooltip.css({opacity:1, display:"none"}).fadeIn(400);
|
|
}).mousemove(function(kmouse){
|
|
var border_top = $(window).scrollTop();
|
|
var border_right = $(window).width();
|
|
var left_pos;
|
|
var top_pos;
|
|
var offset = 15;
|
|
if(border_right - (offset *2) >= my_tooltip.width() + kmouse.pageX){
|
|
left_pos = kmouse.pageX+offset;
|
|
} else{
|
|
left_pos = border_right-my_tooltip.width()-offset;
|
|
}
|
|
|
|
if(border_top + (offset *2)>= kmouse.pageY - my_tooltip.height()){
|
|
top_pos = border_top +offset;
|
|
} else{
|
|
top_pos = kmouse.pageY-my_tooltip.height()-2.2*offset;
|
|
}
|
|
|
|
my_tooltip.css({left:left_pos, top:top_pos});
|
|
}).mouseout(function(){
|
|
my_tooltip.css({left:"-9999px"});
|
|
});
|
|
});
|
|
}
|
|
|
|
$(document).ready(function(){
|
|
simple_tooltip(".tooltip","tooltip_cont");
|
|
$(".cont_butt").on('click', function ()
|
|
{
|
|
//$("#order_form").submit();
|
|
return false;
|
|
});
|
|
if ($.validationEngine) {
|
|
$(".valForm, .uniform").each(function () {
|
|
return;
|
|
if ( $(this).attr("valed") ) return;
|
|
$(this).attr("valed", "1").validationEngine({
|
|
ajaxSubmit: true,
|
|
ajaxSubmitFile: window.location.href
|
|
});
|
|
});
|
|
}
|
|
});
|
|
|
|
})(jQuery)
|
|
|
|
|
|
/*********************************************************************************************************************************/ |