// page init
jQuery(function(){
initCustomForms();
initAnchors();
initCycleCarousel();
initOpenClose();
initLightbox();
initBackgroundResize();
initValidation();
jQuery('input, textarea').placeholder();
});
// initialize custom form elements
function initCustomForms() {
jcf.replaceAll();
}
// form validation function
function initValidation() {
var errorClass = 'error';
var successClass = 'success';
var errorFormClass = 'form-error';
var successFormClass = 'form-success';
var regEmail = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
var regPhone = /^([0-9]{2,4}?(\-)*)+$/;
jQuery('form.validate-form').each(function() {
var form = jQuery(this).attr('novalidate', 'novalidate');
var successFlag = true;
var inputs = form.find('input, textarea, select');
// form validation function
function validateForm(e) {
successFlag = true;
inputs.each(checkField);
if (form.hasClass('ajax-form')) {
e.preventDefault();
if (successFlag){
jQuery.ajax({
type: form.attr('method') || 'POST',
url: form.attr('action'),
data: 'ajax=1' + form.serialize(),
success: function() {
form.removeClass(errorFormClass).addClass(successFormClass);
form.get(0).reset();
},
error: function() {
form.removeClass(successFormClass).addClass(errorFormClass);
}
});
}
} else if (!successFlag) {
e.preventDefault();
}
}
// check field
function checkField(i, obj) {
var currentObject = jQuery(obj);
var currentParent = currentObject.closest('.input-required');
// not empty fields
if(currentObject.hasClass('required')) {
var defaultValue = (currentObject.prop('placeholder'))? currentObject.prop('placeholder') : currentObject.prop('defaultValue');
setState(currentParent, currentObject, !currentObject.val().length || currentObject.val() === defaultValue);
}
// correct email fields
if(currentObject.hasClass('required-email')) {
setState(currentParent, currentObject, !regEmail.test(currentObject.val()));
}
// correct email fields
if(currentObject.hasClass('required-email-confirm')) {
var requiredEmail = form.find('.required-email');
setState(currentParent, currentObject, !regEmail.test(currentObject.val()) || currentObject.val() !== requiredEmail.val());
}
// correct number fields
if(currentObject.hasClass('required-number')) {
setState(currentParent, currentObject, !regPhone.test(currentObject.val()));
}
// something selected
if(currentObject.hasClass('required-select')) {
setState(currentParent, currentObject, currentObject.get(0).selectedIndex === 0);
}
// something checked radio
if(currentObject.hasClass('required-radio')) {
var curName = currentObject.attr('name');
var curRadio = jQuery('[name= "' + curName + '"]');
setState(currentParent, currentObject, !curRadio.is(':checked'));
}
if(currentObject.hasClass('required-one-radio')) {
var curName = currentObject.attr('name');
var curRadio = jQuery('[name= "' + curName + '"]');
var state = ( jQuery('[name= "'+curName+'"]:checked').length > 0 )? false : true;
setState(currentParent, currentObject, state);
}
// something checked checkbox
if (currentObject.hasClass('required-checkbox')) {
setState(currentParent, currentObject, !currentObject.prop('checked'));
}
}
// set state
function setState(hold, field, error) {
if (error) {
form.addClass(errorFormClass);
hold.addClass(errorClass);
field.one('focus click',function(){hold.removeClass(errorClass).removeClass(successClass);});
successFlag = false;
} else {
hold.addClass(successClass);
}
}
// form event handlers
form.submit(validateForm);
});
}
// cycle scroll galleries init
function initCycleCarousel() {
jQuery('.h-slider').scrollAbsoluteGallery({
mask: '.mask',
slider: '.slideset',
slides: '.slide',
btnPrev: 'a.btn-prev',
btnNext: 'a.btn-next',
pagerLinks: '.slide-pagination li',
stretchSlideToMask: true,
pauseOnHover: true,
maskAutoSize: true,
autoRotation: false,
switchTime: 5000,
animSpeed: 500
});
jQuery('.v-slider').scrollAbsoluteGallery({
mask: '.mask',
slider: '.slideset',
slides: '.slide',
btnPrev: 'a.btn-prev',
btnNext: 'a.btn-next',
pagerLinks: '.slide-pagination li',
stretchSlideToMask: true,
pauseOnHover: true,
maskAutoSize: true,
vertical: true,
autoRotation: false,
switchTime: 3000,
animSpeed: 500
});
}
// open-close init
function initOpenClose() {
jQuery('#nav').openClose({
activeClass: 'active',
hideOnClickOutside: true,
opener: '.opener',
slider: '.drop',
animSpeed: 400,
effect: 'slide',
onInit: function(self) {
// handle layout resize
ResponsiveHelper.addRange({
'..767': {
on: function() {
self.slider.on('click.closeDrop', 'a',function() {
self.hideSlide();
});
},
off: function() {
self.slider.off('click.closeDrop', 'a');
}
}
});
}
});
}
// fancybox modal popup init
function initLightbox() {
jQuery('a.lightbox-opener').fancybox({
padding: 0,
loop: false,
helpers: {
overlay: {
css: {
background: 'rgba(0, 0, 0, 0.7)'
}
}
},
afterLoad: function(current, previous) {
// handle custom close button in inline modal
if (current.href.indexOf('#') === 0) {
jQuery(current.href).find('a.close').off('click.fb').on('click.fb', function(e){
e.preventDefault();
jQuery.fancybox.close();
});
}
}
});
jQuery('#login-opener').fancybox({
padding: 0,
autoCenter: false,
loop: false,
helpers: {
overlay: {
css: {
background: 'rgba(0, 0, 0, 0.7)'
}
}
},
beforeShow: function() {
$.fancybox._getPosition = function() {
var position = $('#login-opener').offset();
position["left"] = position["left"] - 271;
// alert(JSON.stringify(position));
// "top":191.5,"left":1037.75
return position;
}
},
afterLoad: function(current, previous) {
// handle custom close button in inline modal
if (current.href.indexOf('#') === 0) {
jQuery(current.href).find('a.close').off('click.fb').on('click.fb', function(e){
e.preventDefault();
jQuery.fancybox.close();
});
}
}
});
}
// initialize smooth anchor links
function initAnchors() {
jQuery('a.anchor').htmlAnchorElement();
var inst = new SmoothScroll({
anchorLinks: '.drop ul .anchor',
separator: '/',
extraOffset: function() {
var totalHeight = 0;
jQuery('#header').each(function(){
totalHeight += jQuery(this).outerHeight();
});
return totalHeight;
},
activeClasses: 'parent',
anchorActiveClass: 'active',
sectionActiveClass: ''
});
jQuery(window).on('load', function() {
setTimeout(function() {
if (inst.anchorLinks.filter('[href="' + window.location.pathname + '"]').length) {
var link = inst.anchorLinks.filter('[href="' + window.location.pathname + '"]'),
targetBlock = inst.getAnchorTarget(link),
targetOffset = inst.getTargetOffset(targetBlock);
SmoothScroll.scrollTo(targetOffset, {
container: inst.container,
wheelBehavior: inst.options.wheelBehavior,
duration: 600
});
}
}, 1);
});
}
// stretch background to fill blocks
function initBackgroundResize() {
jQuery('.bg-stretch').each(function() {
ImageStretcher.add({
container: this,
image: 'img'
});
});
}
;(function($) {
// Extend the tag with the window.history API
// http://www.whatwg.org/specs/web-apps/current-work/multipage/browsers.html#the-history-interface
//
//
// title
var pathname = window.location.pathname;
function HTMLAnchorElement(options) {
this.options = $.extend({
links: null
}, options);
this.init();
}
HTMLAnchorElement.prototype = {
init: function() {
this.findElements();
this.attachEvents();
},
findElements: function() {
this.links = $(this.options.links);
},
attachEvents: function() {
var self = this;
this.clickHandler = function(event){
// open in new tab
if (event.ctrlKey || event.metaKey || event.which === 2) {
return;
}
// pushstate
if (this.hasAttribute('pushstate')) {
//window.history.pushState(JSON.parse(this.getAttribute('state')), this.getAttribute('title'), pathname + this.getAttribute('href'));
$(window).trigger('pushstate');
}
// replacestate
if (this.hasAttribute('replacestate')) {
//window.history.replaceState(JSON.parse(this.getAttribute('state')), this.getAttribute('title'), pathname + this.getAttribute('href'));
$(window).trigger('replacestate');
}
// popstate
if (this.hasAttribute('popstate')) {
try {
var popstateEvent = new PopStateEvent('popstate', {
bubbles: false,
cancelable: false,
state: window.history.state
});
if ('dispatchEvent_' in window) {
// FireFox with polyfill
window.dispatchEvent_(popstateEvent);
} else {
// normal
window.dispatchEvent(popstateEvent);
}
} catch (error) {
// Internet Explorer
var fallbackEvent = document.createEvent('CustomEvent');
fallbackEvent.initCustomEvent('popstate', false, false, {
state: window.history.state
});
window.dispatchEvent(fallbackEvent);
}
}
event.preventDefault();
};
this.links.on('click', this.clickHandler);
}
};
// jquery plugin
$.fn.htmlAnchorElement = function(opt){
return this.each(function(){
$(this).data('HTMLAnchorElement', new HTMLAnchorElement($.extend(opt,{links:this})));
});
};
})(jQuery);
/*
* Responsive Layout helper
*/
ResponsiveHelper = (function($){
// init variables
var handlers = [],
prevWinWidth,
win = $(window),
nativeMatchMedia = false;
// detect match media support
if(window.matchMedia) {
if(window.Window && window.matchMedia === Window.prototype.matchMedia) {
nativeMatchMedia = true;
} else if(window.matchMedia.toString().indexOf('native') > -1) {
nativeMatchMedia = true;
}
}
// prepare resize handler
function resizeHandler() {
var winWidth = win.width();
if(winWidth !== prevWinWidth) {
prevWinWidth = winWidth;
// loop through range groups
$.each(handlers, function(index, rangeObject){
// disable current active area if needed
$.each(rangeObject.data, function(property, item) {
if(item.currentActive && !matchRange(item.range[0], item.range[1])) {
item.currentActive = false;
if(typeof item.disableCallback === 'function') {
item.disableCallback();
}
}
});
// enable areas that match current width
$.each(rangeObject.data, function(property, item) {
if(!item.currentActive && matchRange(item.range[0], item.range[1])) {
// make callback
item.currentActive = true;
if(typeof item.enableCallback === 'function') {
item.enableCallback();
}
}
});
});
}
}
win.bind('load resize orientationchange', resizeHandler);
// test range
function matchRange(r1, r2) {
var mediaQueryString = '';
if(r1 > 0) {
mediaQueryString += '(min-width: ' + r1 + 'px)';
}
if(r2 < Infinity) {
mediaQueryString += (mediaQueryString ? ' and ' : '') + '(max-width: ' + r2 + 'px)';
}
return matchQuery(mediaQueryString, r1, r2);
}
// media query function
function matchQuery(query, r1, r2) {
if(window.matchMedia && nativeMatchMedia) {
return matchMedia(query).matches;
} else if(window.styleMedia) {
return styleMedia.matchMedium(query);
} else if(window.media) {
return media.matchMedium(query);
} else {
return prevWinWidth >= r1 && prevWinWidth <= r2;
}
}
// range parser
function parseRange(rangeStr) {
var rangeData = rangeStr.split('..');
var x1 = parseInt(rangeData[0], 10) || -Infinity;
var x2 = parseInt(rangeData[1], 10) || Infinity;
return [x1, x2].sort(function(a, b){
return a - b;
});
}
// export public functions
return {
addRange: function(ranges) {
// parse data and add items to collection
var result = {data:{}};
$.each(ranges, function(property, data){
result.data[property] = {
range: parseRange(property),
enableCallback: data.on,
disableCallback: data.off
};
});
handlers.push(result);
// call resizeHandler to recalculate all events
prevWinWidth = null;
resizeHandler();
}
};
}(jQuery));
/*
* jQuery Cycle Carousel plugin
*/
;(function($){
function ScrollAbsoluteGallery(options) {
this.options = $.extend({
activeClass: 'active',
mask: 'div.slides-mask',
slider: '>ul',
slides: '>li',
btnPrev: '.btn-prev',
btnNext: '.btn-next',
pagerLinks: 'ul.pager > li',
generatePagination: false,
pagerList: '
',
pagerListItem: ' ',
pagerListItemText: 'a',
galleryReadyClass: 'gallery-js-ready',
currentNumber: 'span.current-num',
totalNumber: 'span.total-num',
maskAutoSize: false,
autoRotation: false,
pauseOnHover: false,
stretchSlideToMask: false,
switchTime: 3000,
animSpeed: 500,
handleTouch: true,
swipeThreshold: 15,
vertical: false
}, options);
this.init();
}
ScrollAbsoluteGallery.prototype = {
init: function() {
if(this.options.holder) {
this.findElements();
this.attachEvents();
this.makeCallback('onInit', this);
}
},
findElements: function() {
// find structure elements
this.holder = $(this.options.holder).addClass(this.options.galleryReadyClass);
this.mask = this.holder.find(this.options.mask);
this.slider = this.mask.find(this.options.slider);
this.slides = this.slider.find(this.options.slides);
this.btnPrev = this.holder.find(this.options.btnPrev);
this.btnNext = this.holder.find(this.options.btnNext);
// slide count display
this.currentNumber = this.holder.find(this.options.currentNumber);
this.totalNumber = this.holder.find(this.options.totalNumber);
// create gallery pagination
if(typeof this.options.generatePagination === 'string') {
this.pagerLinks = this.buildPagination();
} else {
this.pagerLinks = this.holder.find(this.options.pagerLinks);
}
// define index variables
this.sizeProperty = this.options.vertical ? 'height' : 'width';
this.positionProperty = this.options.vertical ? 'top' : 'left';
this.animProperty = this.options.vertical ? 'marginTop' : 'marginLeft';
this.slideSize = this.slides[this.sizeProperty]();
this.currentIndex = 0;
this.prevIndex = 0;
// reposition elements
this.options.maskAutoSize = this.options.vertical ? false : this.options.maskAutoSize;
if(this.options.vertical) {
this.mask.css({
height: this.slides.innerHeight()
});
}
if(this.options.maskAutoSize){
this.mask.css({
height: this.slider.height()
});
}
this.slider.css({
position: 'relative',
height: this.options.vertical ? this.slideSize * this.slides.length : '100%'
});
this.slides.css({
position: 'absolute'
}).css(this.positionProperty, -9999).eq(this.currentIndex).css(this.positionProperty, 0);
this.refreshState();
},
buildPagination: function() {
var pagerLinks = $();
if(!this.pagerHolder) {
this.pagerHolder = this.holder.find(this.options.generatePagination);
}
if(this.pagerHolder.length) {
this.pagerHolder.empty();
this.pagerList = $(this.options.pagerList).appendTo(this.pagerHolder);
for(var i = 0; i < this.slides.length; i++) {
$(this.options.pagerListItem).appendTo(this.pagerList).find(this.options.pagerListItemText).text(i+1);
}
pagerLinks = this.pagerList.children();
}
return pagerLinks;
},
attachEvents: function() {
// attach handlers
var self = this;
if(this.btnPrev.length) {
this.btnPrevHandler = function(e) {
e.preventDefault();
self.prevSlide();
};
this.btnPrev.click(this.btnPrevHandler);
}
if(this.btnNext.length) {
this.btnNextHandler = function(e) {
e.preventDefault();
self.nextSlide();
};
this.btnNext.click(this.btnNextHandler);
}
if(this.pagerLinks.length) {
this.pagerLinksHandler = function(e) {
e.preventDefault();
self.numSlide(self.pagerLinks.index(e.currentTarget));
};
this.pagerLinks.click(this.pagerLinksHandler);
}
// handle autorotation pause on hover
if(this.options.pauseOnHover) {
this.hoverHandler = function() {
clearTimeout(self.timer);
};
this.leaveHandler = function() {
self.autoRotate();
};
this.holder.bind({mouseenter: this.hoverHandler, mouseleave: this.leaveHandler});
}
// handle holder and slides dimensions
this.resizeHandler = function() {
if(!self.animating) {
if(self.options.stretchSlideToMask) {
self.resizeSlides();
}
self.resizeHolder();
self.setSlidesPosition(self.currentIndex);
}
};
$(window).bind('load resize orientationchange', this.resizeHandler);
if(self.options.stretchSlideToMask) {
self.resizeSlides();
}
// handle swipe on mobile devices
if(this.options.handleTouch && window.Hammer && this.mask.length && this.slides.length > 1 && isTouchDevice) {
this.swipeHandler = new Hammer.Manager(this.mask[0]);
this.swipeHandler.add(new Hammer.Pan({
direction: self.options.vertical ? Hammer.DIRECTION_VERTICAL : Hammer.DIRECTION_HORIZONTAL,
threshold: self.options.swipeThreshold
}));
this.swipeHandler.on('panstart', function() {
if(self.animating) {
self.swipeHandler.stop();
} else {
clearTimeout(self.timer);
}
}).on('panmove', function(e) {
self.swipeOffset = -self.slideSize + e[self.options.vertical ? 'deltaY' : 'deltaX'];
self.slider.css(self.animProperty, self.swipeOffset);
clearTimeout(self.timer);
}).on('panend', function(e) {
if(e.distance > self.options.swipeThreshold) {
if(e.offsetDirection === Hammer.DIRECTION_RIGHT || e.offsetDirection === Hammer.DIRECTION_DOWN) {
self.nextSlide();
} else {
self.prevSlide();
}
} else {
var tmpObj = {};
tmpObj[self.animProperty] = -self.slideSize;
self.slider.animate(tmpObj, {duration: self.options.animSpeed});
self.autoRotate();
}
self.swipeOffset = 0;
});
}
// start autorotation
this.autoRotate();
this.resizeHolder();
this.setSlidesPosition(this.currentIndex);
},
resizeSlides: function() {
this.slideSize = this.mask[this.options.vertical ? 'height' : 'width']();
this.slides.css(this.sizeProperty, this.slideSize);
},
resizeHolder: function() {
if(this.options.maskAutoSize) {
this.mask.css({
height: this.slides.eq(this.currentIndex).outerHeight(true)
});
}
},
prevSlide: function() {
if(!this.animating && this.slides.length > 1) {
this.direction = -1;
this.prevIndex = this.currentIndex;
if(this.currentIndex > 0) this.currentIndex--;
else this.currentIndex = this.slides.length - 1;
this.switchSlide();
}
},
nextSlide: function(fromAutoRotation) {
if(!this.animating && this.slides.length > 1) {
this.direction = 1;
this.prevIndex = this.currentIndex;
if(this.currentIndex < this.slides.length - 1) this.currentIndex++;
else this.currentIndex = 0;
this.switchSlide();
}
},
numSlide: function(c) {
if(!this.animating && this.currentIndex !== c && this.slides.length > 1) {
this.direction = c > this.currentIndex ? 1 : -1;
this.prevIndex = this.currentIndex;
this.currentIndex = c;
this.switchSlide();
}
},
preparePosition: function() {
// prepare slides position before animation
this.setSlidesPosition(this.prevIndex, this.direction < 0 ? this.currentIndex : null, this.direction > 0 ? this.currentIndex : null, this.direction);
},
setSlidesPosition: function(index, slideLeft, slideRight, direction) {
// reposition holder and nearest slides
if(this.slides.length > 1) {
var prevIndex = (typeof slideLeft === 'number' ? slideLeft : index > 0 ? index - 1 : this.slides.length - 1);
var nextIndex = (typeof slideRight === 'number' ? slideRight : index < this.slides.length - 1 ? index + 1 : 0);
this.slider.css(this.animProperty, this.swipeOffset ? this.swipeOffset : -this.slideSize);
this.slides.css(this.positionProperty, -9999).eq(index).css(this.positionProperty, this.slideSize);
if(prevIndex === nextIndex && typeof direction === 'number') {
var calcOffset = direction > 0 ? this.slideSize*2 : 0;
this.slides.eq(nextIndex).css(this.positionProperty, calcOffset);
} else {
this.slides.eq(prevIndex).css(this.positionProperty, 0);
this.slides.eq(nextIndex).css(this.positionProperty, this.slideSize*2);
}
}
},
switchSlide: function() {
// prepare positions and calculate offset
var self = this;
var oldSlide = this.slides.eq(this.prevIndex);
var newSlide = this.slides.eq(this.currentIndex);
this.animating = true;
// resize mask to fit slide
if(this.options.maskAutoSize) {
this.mask.animate({
height: newSlide.outerHeight(true)
}, {
duration: this.options.animSpeed
});
}
// start animation
var animProps = {};
animProps[this.animProperty] = this.direction > 0 ? -this.slideSize*2 : 0;
this.preparePosition();
this.slider.animate(animProps,{duration:this.options.animSpeed, complete:function() {
self.setSlidesPosition(self.currentIndex);
// start autorotation
self.animating = false;
self.autoRotate();
// onchange callback
self.makeCallback('onChange', self);
}});
// refresh classes
this.refreshState();
// onchange callback
this.makeCallback('onBeforeChange', this);
},
refreshState: function(initial) {
// slide change function
this.slides.removeClass(this.options.activeClass).eq(this.currentIndex).addClass(this.options.activeClass);
this.pagerLinks.removeClass(this.options.activeClass).eq(this.currentIndex).addClass(this.options.activeClass);
// display current slide number
this.currentNumber.html(this.currentIndex + 1);
this.totalNumber.html(this.slides.length);
// add class if not enough slides
this.holder.toggleClass('not-enough-slides', this.slides.length === 1);
},
autoRotate: function() {
var self = this;
clearTimeout(this.timer);
if(this.options.autoRotation) {
this.timer = setTimeout(function() {
self.nextSlide();
}, this.options.switchTime);
}
},
makeCallback: function(name) {
if(typeof this.options[name] === 'function') {
var args = Array.prototype.slice.call(arguments);
args.shift();
this.options[name].apply(this, args);
}
},
destroy: function() {
// destroy handler
this.btnPrev.unbind('click', this.btnPrevHandler);
this.btnNext.unbind('click', this.btnNextHandler);
this.pagerLinks.unbind('click', this.pagerLinksHandler);
this.holder.unbind('mouseenter', this.hoverHandler);
this.holder.unbind('mouseleave', this.leaveHandler);
$(window).unbind('load resize orientationchange', this.resizeHandler);
clearTimeout(this.timer);
// destroy swipe handler
if(this.swipeHandler) {
this.swipeHandler.destroy();
}
// remove inline styles, classes and pagination
this.holder.removeClass(this.options.galleryReadyClass);
this.slider.add(this.slides).removeAttr('style');
if(typeof this.options.generatePagination === 'string') {
this.pagerHolder.empty();
}
}
};
// detect device type
var isTouchDevice = /Windows Phone/.test(navigator.userAgent) || ('ontouchstart' in window) || window.DocumentTouch && document instanceof DocumentTouch;
// jquery plugin
$.fn.scrollAbsoluteGallery = function(opt){
return this.each(function(){
$(this).data('ScrollAbsoluteGallery', new ScrollAbsoluteGallery($.extend(opt,{holder:this})));
});
};
}(jQuery));
/*
* jQuery Open/Close plugin
*/
;(function($) {
function OpenClose(options) {
this.options = $.extend({
addClassBeforeAnimation: true,
hideOnClickOutside: false,
activeClass:'active',
opener:'.opener',
slider:'.slide',
animSpeed: 400,
effect:'fade',
event:'click'
}, options);
this.init();
}
OpenClose.prototype = {
init: function() {
if(this.options.holder) {
this.findElements();
this.attachEvents();
this.makeCallback('onInit', this);
}
},
findElements: function() {
this.holder = $(this.options.holder);
this.opener = this.holder.find(this.options.opener);
this.slider = this.holder.find(this.options.slider);
},
attachEvents: function() {
// add handler
var self = this;
this.eventHandler = function(e) {
e.preventDefault();
if (self.slider.hasClass(slideHiddenClass)) {
self.showSlide();
} else {
self.hideSlide();
}
};
self.opener.bind(self.options.event, this.eventHandler);
// hover mode handler
if(self.options.event === 'over') {
self.opener.bind('mouseenter', function() {
self.showSlide();
});
self.holder.bind('mouseleave', function() {
self.hideSlide();
});
}
// outside click handler
self.outsideClickHandler = function(e) {
if(self.options.hideOnClickOutside) {
var target = $(e.target);
if (!target.is(self.holder) && !target.closest(self.holder).length) {
self.hideSlide();
}
}
};
// set initial styles
if (this.holder.hasClass(this.options.activeClass)) {
$(document).bind('click touchstart', self.outsideClickHandler);
} else {
this.slider.addClass(slideHiddenClass);
}
},
showSlide: function() {
var self = this;
if (self.options.addClassBeforeAnimation) {
self.holder.addClass(self.options.activeClass);
}
self.slider.removeClass(slideHiddenClass);
$(document).bind('click touchstart', self.outsideClickHandler);
self.makeCallback('animStart', true);
toggleEffects[self.options.effect].show({
box: self.slider,
speed: self.options.animSpeed,
complete: function() {
if (!self.options.addClassBeforeAnimation) {
self.holder.addClass(self.options.activeClass);
}
self.makeCallback('animEnd', true);
}
});
},
hideSlide: function() {
var self = this;
if (self.options.addClassBeforeAnimation) {
self.holder.removeClass(self.options.activeClass);
}
$(document).unbind('click touchstart', self.outsideClickHandler);
self.makeCallback('animStart', false);
toggleEffects[self.options.effect].hide({
box: self.slider,
speed: self.options.animSpeed,
complete: function() {
if (!self.options.addClassBeforeAnimation) {
self.holder.removeClass(self.options.activeClass);
}
self.slider.addClass(slideHiddenClass);
self.makeCallback('animEnd', false);
}
});
},
destroy: function() {
this.slider.removeClass(slideHiddenClass).css({display:''});
this.opener.unbind(this.options.event, this.eventHandler);
this.holder.removeClass(this.options.activeClass).removeData('OpenClose');
$(document).unbind('click touchstart', this.outsideClickHandler);
},
makeCallback: function(name) {
if(typeof this.options[name] === 'function') {
var args = Array.prototype.slice.call(arguments);
args.shift();
this.options[name].apply(this, args);
}
}
};
// add stylesheet for slide on DOMReady
var slideHiddenClass = 'js-slide-hidden';
(function() {
var tabStyleSheet = $('").appendTo("head")})})(window,document,jQuery);