(function ($) {
effectsIn = [
'bounceIn',
'bounceInDown',
'bounceInUp',
'bounceInLeft',
'bounceInRight',
'fadeIn',
'fadeInUp',
'fadeInDown',
'fadeInLeft',
'fadeInRight',
'fadeInUpBig',
'fadeInDownBig',
'fadeInLeftBig',
'fadeInRightBig',
'flipInX',
'flipInY',
'foolishIn', //-
'lightSpeedIn',
'rollIn',
'rotateIn',
'rotateInDownLeft',
'rotateInDownRight',
'rotateInUpLeft',
'rotateInUpRight',
'twisterInDown', //-
'twisterInUp', //-
'swap', //-
'swashIn', //-
'tinRightIn', //-
'tinLeftIn', //-
'tinUpIn', //-
'tinDownIn', //-
];
effectsOut = [
'bombRightOut', //-
'bombLeftOut', //-
'bounceOut',
'bounceOutDown',
'bounceOutUp',
'bounceOutLeft',
'bounceOutRight',
'fadeOut',
'fadeOutUp',
'fadeOutDown',
'fadeOutLeft',
'fadeOutRight',
'fadeOutUpBig',
'fadeOutDownBig',
'fadeOutLeftBig',
'fadeOutRightBig',
'flipOutX',
'flipOutY',
'foolishOut', //-
'hinge',
'holeOut', //-
'lightSpeedOut',
'puffOut', //-
'rollOut',
'rotateOut',
'rotateOutDownLeft',
'rotateOutDownRight',
'rotateOutUpLeft',
'rotateOutUpRight',
'rotateDown', //-
'rotateUp', //-
'rotateLeft', //-
'rotateRight', //-
'swashOut', //-
'tinRightOut', //-
'tinLeftOut', //-
'tinUpOut', //-
'tinDownOut', //-
'vanishOut' //-
];
var e_in_length = effectsIn.length;
var e_out_length = effectsOut.length;
$.fn.mdSlider = function (options) {
var defaults = {
className: 'md-slide-wrap',
itemClassName: 'md-slide-item',
transitions: 'strip-down-left', // name of transition effect (fade, scrollLeft, scrollRight, scrollHorz, scrollUp, scrollDown, scrollVert)
transitionsSpeed: 800, // speed of the transition (millisecond)
width: 990, // responsive = false: this appear as container width; responsive = true: use for scale ;fullwidth = true: this is effect zone width
height: 420, // container height
responsive: true,
fullwidth: true,
styleBorder: 0, // Border style, from 1 - 9, 0 to disable
styleShadow: 0, // Dropshadow style, from 1 - 5, 0 to disable
posBullet: 2, // Bullet position, from 1 to 6, default is 5
posThumb: 1, // Thumbnail position, from 1 to 5, default is 1
stripCols: 20,
stripRows: 10,
slideShowDelay: 6000, // stop time for each slide item (millisecond)
slideShow: true,
loop: false,
pauseOnHover: false,
showLoading: true, // Show/hide loading bar
loadingPosition: 'bottom', // choose your loading bar position (top, bottom)
showArrow: true, // show/hide next, previous arrows
showBullet: true,
videoBox: false,
showThumb: true, // Show thumbnail, if showBullet = true and showThumb = true, thumbnail will be shown when you hover bullet navigation
enableDrag: true, // Enable mouse drag
touchSensitive: 50,
onEndTransition: function () {
}, //this callback is invoked when the transition effect ends
onStartTransition: function () {
} //this callback is invoked when the transition effect starts
};
options = $.extend({}, defaults, options);
var self = $(this), slideItems = [], oIndex, activeIndex = -1, numItem = 0, slideWidth, slideHeight, lock = true,
wrap,
hoverDiv,
hasTouch,
arrowButton,
buttons,
loadingBar,
timerGlow,
slideThumb,
minThumbsLeft = 0,
touchstart = false,
isScrolling,
mouseleft,
thumbsDrag = false,
slideShowDelay = 0,
play = false,
pause = false,
timer,
step = 0;
var Utils = {
/**
* range Get an array of numbers within a range
* @param min {number} Lowest number in array
* @param max {number} Highest number in array
* @param rand {bool} Shuffle array
* @return {array}
*/
range: function (min, max, rand) {
var arr = ( new Array(++max - min) ).join('.').split('.').map(function (v, i) {
return min + i
});
return rand ? arr.map(function (v) {
return [Math.random(), v]
}).sort().map(function (v) {
return v[1]
}) : arr;
}
};
// init
function init() {
if ("ActiveXObject" in window)
$(".md-item-opacity", self).addClass("md-ieopacity");
self.addClass("loading-image");
var slideClass = '';
if (options.responsive)
slideClass += ' md-slide-responsive';
if (options.fullwidth)
slideClass += ' md-slide-fullwidth';
if (options.showBullet && options.posBullet)
slideClass += ' md-slide-bullet-' + options.posBullet;
if (!options.showBullet && options.showThumb && options.posThumb)
slideClass += ' md-slide-thumb-' + options.posThumb;
self.wrap('
');
hoverDiv = self.parent();
wrap = hoverDiv.parent();
slideWidth = options.responsive ? self.width() : options.width;
slideHeight = options.height;
slideItems = [];
hasTouch = documentHasTouch();
if (hasTouch)
wrap.addClass("md-touchdevice");
//
self.find('.' + options.itemClassName).each(function (index) {
numItem++;
slideItems[index] = $(this);
$(this).find(".md-object").each(function () {
var top = $(this).data("y") ? $(this).data("y") : 0,
left = $(this).data("x") ? $(this).data("x") : 0,
width = $(this).data("width") ? $(this).data("width") : 0,
height = $(this).data("height") ? $(this).data("height") : 0;
if (width > 0) {
$(this).width((width / options.width * 100) + "%");
}
if (height > 0) {
$(this).height((height / options.height * 100) + "%");
}
var css = {
top: (top / options.height * 100) + "%",
left: (left / options.width * 100) + "%"
};
$(this).css(css);
});
if (index > 0)
$(this).hide();
});
initControl();
initDrag();
if (options.slideShow) {
play = true;
}
$('.md-object', self).hide();
if ($(".md-video", wrap).size() > 0) {
if (options.videoBox) {
$(".md-video", wrap).mdvideobox();
} else {
var videoCtrl = $('');
wrap.append(videoCtrl);
$(".md-video", wrap).click(function () {
var video_ele = $("");
video_ele.attr('allowFullScreen', '').attr('frameborder', '0').css({
width: "100%",
height: "100%",
background: "black"
});
video_ele.attr("src", $(this).attr("href"));
var closeButton = $('');
closeButton.click(function () {
videoCtrl.html("").hide();
play = true;
return false;
});
videoCtrl.html("").append(video_ele).append(closeButton).show();
play = false;
return false;
});
}
}
$(window).resize(function () {
resizeWindow();
}).trigger("resize");
preloadImages();
// process when un-active tab
var inActiveTime = false;
$(window).blur(function () {
inActiveTime = (new Date()).getTime();
});
$(window).focus(function () {
if (inActiveTime) {
var duration = (new Date()).getTime() - inActiveTime;
if (duration > slideShowDelay - step)
step = slideShowDelay - 200;
else
step += duration;
inActiveTime = false;
}
});
}
function initControl() {
// Loading bar
if (options.slideShow && options.showLoading) {
var loadingDiv = $('');
wrap.append(loadingDiv);
loadingBar = $(".br-timer-bar", loadingDiv);
timerGlow = $(".br-timer-glow", loadingDiv);
}
if (options.slideShow && options.pauseOnHover) {
hoverDiv.hover(function () {
pause = true;
}, function () {
pause = false;
});
}
// Border
if (options.styleBorder != 0) {
var borderDivs = '';
borderDivs += '';
if (!options.fullwidth) {
borderDivs += '';
borderDivs += '';
}
wrap.append(borderDivs);
}
// Shadow
if (options.styleShadow != 0) {
var shadowDivs = '';
}
// Next, preview arrow
if (options.showArrow) {
arrowButton = $('');
hoverDiv.append(arrowButton);
$('.md-arrow-right', arrowButton).bind('click', function () {
slideNext();
});
$('.md-arrow-left', arrowButton).bind('click', function () {
slidePrev();
});
}
;
if (options.showBullet != false) {
buttons = $('');
wrap.append(buttons);
for (var i = 0; i < numItem; i++) {
buttons.append('');
}
;
if (options.showThumb) {
var thumbW = parseInt(self.data("thumb-width")),
thumbH = parseInt(self.data("thumb-height"));
for (var i = 0; i < numItem; i++) {
var thumbSrc = slideItems[i].data("thumb"),
thumbType = slideItems[i].data("thumb-type"),
thumbAlt = slideItems[i].data("thumb-alt");
if (thumbSrc) {
var thumb;
if (thumbType == "image")
thumb = $('').attr("src", thumbSrc).attr("alt", slideItems[i].data("thumb-alt")).css({
top: -(9 + thumbH) + "px",
left: -(thumbW / 2 - 2) + "px",
opacity: 0
})
else
thumb = $("").attr("style", thumbSrc).css({
top: -(9 + thumbH) + "px",
left: -(thumbW / 2 - 2) + "px",
opacity: 0
});
$('div.md-bullet:eq(' + i + ')', buttons).append(thumb).append('');
}
}
$('div.md-bullet', buttons).hover(function () {
$(this).addClass('md_hover');
$("img, span", this).show().animate({'opacity': 1}, 200);
$('.md-thumb-arrow', this).show().animate({'opacity': 1}, 200);
}, function () {
$(this).removeClass('md_hover');
$('img, span', this).animate({'opacity': 0}, 200, function () {
$(this).hide();
});
$('.md-thumb-arrow', this).animate({'opacity': 0}, 200, function () {
$(this).hide();
});
});
}
$('div.md-bullet', wrap).click(function () {
if ($(this).hasClass('md-current')) {
return false;
}
;
var index = $(this).attr('rel');
slide(index);
});
} else if (options.showThumb) {
var thumbDiv = $('').appendTo(wrap);
slideThumb = $(".md-thumb-items", thumbDiv);
for (var i = 0; i < numItem; i++) {
var thumbSrc = slideItems[i].data("thumb"),
thumbType = slideItems[i].data("thumb-type"),
thumbAlt = slideItems[i].data("thumb-alt");
if (thumbSrc) {
var $link = $('').attr("rel", i);
if (thumbType == "image")
$link.append($('').attr("src", thumbSrc).attr("alt", slideItems[i].data("thumb-alt")))
else
$link.append($('').attr("style", thumbSrc).css("display", "inline-block"));
slideThumb.append($link);
}
}
$("a", slideThumb).click(function () {
if ($(this).hasClass('md-current') || thumbsDrag) {
return false;
}
;
var index = $(this).attr('rel');
slide(index);
});
}
}
function initDrag() {
if (hasTouch) {
self.bind('touchstart', function (event) {
if (touchstart) return false;
event = event.originalEvent.touches[0] || event.originalEvent.changedTouches[0];
touchstart = true;
isScrolling = undefined;
self.mouseY = event.pageY;
self.mouseX = event.pageX;
});
self.bind('touchmove', function (event) {
event = event.originalEvent.touches[0] || event.originalEvent.changedTouches[0];
if (touchstart) {
var pageX = (event.pageX || event.clientX);
var pageY = (event.pageY || event.clientY);
if (typeof isScrolling == 'undefined') {
isScrolling = !!( isScrolling || Math.abs(pageY - self.mouseY) > Math.abs(pageX - self.mouseX) )
}
if (isScrolling) {
touchstart = false;
return
} else {
mouseleft = pageX - self.mouseX;
return false;
}
}
;
return;
});
self.bind('touchend', function (event) {
if (touchstart) {
touchstart = false;
if (mouseleft > options.touchSensitive) {
slidePrev();
mouseleft = 0;
return false;
} else if (mouseleft < -options.touchSensitive) {
slideNext();
mouseleft = 0;
return false;
}
}
});
} else {
hoverDiv.hover(function () {
if (arrowButton) {
arrowButton.addClass('active');
}
}, function () {
if (arrowButton) {
arrowButton.removeClass('active');
}
});
wrap.trigger("hover");
}
if (options.enableDrag) {
self.mousedown(function (event) {
if (!touchstart) {
touchstart = true;
isScrolling = undefined;
self.mouseY = event.pageY;
self.mouseX = event.pageX;
}
;
return false;
});
self.mousemove(function (event) {
if (touchstart) {
var pageX = (event.pageX || event.clientX);
var pageY = (event.pageY || event.clientY);
if (typeof isScrolling == 'undefined') {
isScrolling = !!( isScrolling || Math.abs(pageY - self.mouseY) > Math.abs(pageX - self.mouseX) )
}
if (isScrolling) {
touchstart = false;
return
} else {
mouseleft = pageX - self.mouseX;
return false;
}
}
;
return;
});
self.mouseup(function (event) {
if (touchstart) {
touchstart = false;
if (mouseleft > options.touchSensitive) {
slidePrev();
} else if (mouseleft < -options.touchSensitive) {
slideNext();
}
mouseleft = 0;
return false;
}
});
self.mouseleave(function (event) {
self.mouseup();
});
}
;
}
function resizeThumbDiv() {
if (slideThumb) {
slideThumb.unbind("touchstart");
slideThumb.unbind("touchmove");
slideThumb.unbind("touchmove");
slideThumb.css("left", 0);
var thumbsWidth = 0,
thumbDiv = slideThumb.parent().parent();
$("a.md-thumb-item", slideThumb).each(function () {
if ($("img", $(this)).length > 0) {
if ($("img", $(this)).css("borderLeftWidth"))
thumbsWidth += parseInt($("img", $(this)).css("borderLeftWidth"), 10);
if ($("img", $(this)).css("borderRightWidth"))
thumbsWidth += parseInt($("img", $(this)).css("borderRightWidth"), 10);
if ($("img", $(this)).css("marginLeft"))
thumbsWidth += parseInt($("img", $(this)).css("marginLeft"), 10);
if ($("img", $(this)).css("marginRight"))
thumbsWidth += parseInt($("img", $(this)).css("marginRight"), 10);
}
else {
if ($("span", $(this)).css("borderLeftWidth"))
thumbsWidth += parseInt($("span", $(this)).css("borderLeftWidth"), 10);
if ($("span", $(this)).css("borderRightWidth"))
thumbsWidth += parseInt($("span", $(this)).css("borderRightWidth"), 10);
if ($("span", $(this)).css("marginLeft"))
thumbsWidth += parseInt($("span", $(this)).css("marginLeft"), 10);
if ($("span", $(this)).css("marginRight"))
thumbsWidth += parseInt($("span", $(this)).css("marginRight"), 10);
}
if ($(this).css("borderLeftWidth"))
thumbsWidth += parseInt($(this).css("borderLeftWidth"), 10);
if ($(this).css("borderRightWidth"))
thumbsWidth += parseInt($(this).css("borderRightWidth"), 10);
if ($(this).css("marginLeft"))
thumbsWidth += parseInt($(this).css("marginLeft"), 10);
if ($(this).css("marginRight"))
thumbsWidth += parseInt($(this).css("marginRight"), 10);
thumbsWidth += parseInt(self.data("thumb-width"));
});
$(".md-thumb-next", thumbDiv).remove();
$(".md-thumb-prev", thumbDiv).remove();
if (thumbsWidth > $(".md-thumb-container", thumbDiv).width()) {
minThumbsLeft = $(".md-thumb-container", thumbDiv).width() - thumbsWidth;
slideThumb.width(thumbsWidth);
thumbDiv.append('');
$(".md-thumb-prev", thumbDiv).click(function () {
scollThumb("right");
});
$(".md-thumb-next", thumbDiv).click(function () {
scollThumb("left");
});
checkThumbArrow();
if (hasTouch) {
thumbsDrag = true;
var thumbTouch, thumbLeft;
slideThumb.bind('touchstart', function (event) {
event = event.originalEvent.touches[0] || event.originalEvent.changedTouches[0];
thumbTouch = true;
this.mouseX = event.pageX;
thumbLeft = slideThumb.position().left;
return false;
});
slideThumb.bind('touchmove', function (event) {
event.preventDefault();
event = event.originalEvent.touches[0] || event.originalEvent.changedTouches[0];
if (thumbTouch) {
slideThumb.css("left", thumbLeft + event.pageX - this.mouseX);
}
;
return false;
});
slideThumb.bind('touchend', function (event) {
event.preventDefault();
event = event.originalEvent.touches[0] || event.originalEvent.changedTouches[0];
thumbTouch = false;
if (Math.abs(event.pageX - this.mouseX) < options.touchSensitive) {
var item = $(event.target).closest('a.md-thumb-item');
if (item.length) {
slide(item.attr('rel'));
}
slideThumb.stop(true, true).animate({left: thumbLeft}, 400);
return false;
}
if (slideThumb.position().left < minThumbsLeft) {
slideThumb.stop(true, true).animate({left: minThumbsLeft}, 400, function () {
checkThumbArrow()
});
} else if (slideThumb.position().left > 0) {
slideThumb.stop(true, true).animate({left: 0}, 400, function () {
checkThumbArrow()
});
}
thumbLeft = 0;
return false;
});
}
}
}
}
function scollThumb(position) {
if (slideThumb) {
if (position == "left") {
var thumbLeft = slideThumb.position().left;
if (thumbLeft > minThumbsLeft) {
var containerWidth = $(".md-thumb-container", wrap).width();
if ((thumbLeft - containerWidth) > minThumbsLeft) {
slideThumb.stop(true, true).animate({left: thumbLeft - containerWidth}, 400, function () {
checkThumbArrow()
});
} else {
slideThumb.stop(true, true).animate({left: minThumbsLeft}, 400, function () {
checkThumbArrow()
});
}
}
} else if (position == "right") {
var thumbLeft = slideThumb.position().left;
if (thumbLeft < 0) {
var containerWidth = $(".md-thumb-container", wrap).width();
if ((thumbLeft + containerWidth) < 0) {
slideThumb.stop(true, true).animate({left: thumbLeft + containerWidth}, 400, function () {
checkThumbArrow()
});
} else {
slideThumb.stop(true, true).animate({left: 0}, 400, function () {
checkThumbArrow()
});
}
}
} else {
var thumbCurrent = $("a", slideThumb).index($("a.md-current", slideThumb));
if (thumbCurrent >= 0) {
var thumbLeft = slideThumb.position().left;
var currentLeft = thumbCurrent * $("a", slideThumb).width();
if (currentLeft + thumbLeft < 0) {
slideThumb.stop(true, true).animate({left: -currentLeft}, 400, function () {
checkThumbArrow()
});
} else {
var currentRight = currentLeft + $("a", slideThumb).width();
var containerWidth = $(".md-thumb-container", wrap).width();
if (currentRight + thumbLeft > containerWidth) {
slideThumb.stop(true, true).animate({left: containerWidth - currentRight}, 400, function () {
checkThumbArrow()
});
}
}
}
}
}
}
function checkThumbArrow() {
var thumbLeft = slideThumb.position().left;
if (thumbLeft > minThumbsLeft) {
$(".md-thumb-next", wrap).show();
} else {
$(".md-thumb-next", wrap).hide();
}
if (thumbLeft < 0) {
$(".md-thumb-prev", wrap).show();
} else {
$(".md-thumb-prev", wrap).hide();
}
}
function slide(index) {
step = 0;
slideShowDelay = slideItems[index].data("timeout") ? slideItems[index].data("timeout") : options.slideShowDelay;
if (loadingBar) {
var width = step * slideWidth / slideShowDelay;
loadingBar.width(width);
timerGlow.css({left: width - 100 + 'px'});
}
oIndex = activeIndex;
activeIndex = index;
options.onStartTransition.call(self);
if (slideItems[oIndex]) {
$('div.md-bullet:eq(' + oIndex + ')', buttons).removeClass('md-current');
$('a:eq(' + oIndex + ')', slideThumb).removeClass('md-current');
removeTheCaptions(slideItems[oIndex]);
var fx = options.transitions;
//Generate random transition
if (options.transitions.toLowerCase() == 'random') {
var transitions = new Array(
'slit-horizontal-left-top',
'slit-horizontal-top-right',
'slit-horizontal-bottom-up',
'slit-vertical-down',
'slit-vertical-up',
'strip-up-right',
'strip-up-left',
'strip-down-right',
'strip-down-left',
'strip-left-up',
'strip-left-down',
'strip-right-up',
'strip-right-down',
'strip-right-left-up',
'strip-right-left-down',
'strip-up-down-right',
'strip-up-down-left',
'left-curtain',
'right-curtain',
'top-curtain',
'bottom-curtain',
'slide-in-right',
'slide-in-left',
'slide-in-up',
'slide-in-down',
'fade');
fx = transitions[Math.floor(Math.random() * (transitions.length + 1))];
if (fx == undefined) fx = 'fade';
fx = $.trim(fx.toLowerCase());
}
//Run random transition from specified set (eg: effect:'strip-left-fade,right-curtain')
if (options.transitions.indexOf(',') != -1) {
var transitions = options.transitions.split(',');
fx = transitions[Math.floor(Math.random() * (transitions.length))];
if (fx == undefined) fx = 'fade';
fx = $.trim(fx.toLowerCase());
}
//Custom transition as defined by "data-transition" attribute
if (slideItems[activeIndex].data('transition')) {
var transitions = slideItems[activeIndex].data('transition').split(',');
fx = transitions[Math.floor(Math.random() * (transitions.length))];
fx = $.trim(fx.toLowerCase());
}
if (!(this.support = Modernizr.csstransitions && Modernizr.csstransforms3d) && (fx == 'slit-horizontal-left-top' || fx == 'slit-horizontal-top-right' || fx == 'slit-horizontal-bottom-up' || fx == 'slit-vertical-down' || fx == 'slit-vertical-up')) {
fx = 'fade';
}
lock = true;
runTransition(fx);
if (buttons)
$('div.md-bullet:eq(' + activeIndex + ')', buttons).addClass('md-current');
if (slideThumb)
$('a:eq(' + activeIndex + ')', slideThumb).addClass('md-current');
scollThumb();
} else {
slideItems[activeIndex].css({top: 0, left: 0}).show();
animateTheCaptions(slideItems[index]);
if (buttons)
$('div.md-bullet:eq(' + activeIndex + ')', buttons).addClass('md-current');
if (slideThumb)
$('a:eq(' + activeIndex + ')', slideThumb).addClass('md-current');
scollThumb();
lock = false;
}
}
function setTimer() {
slide(0);
timer = setInterval(next, 40);
}
function next() {
if (lock) return false;
if (play && !pause) {
step += 40;
if (step > slideShowDelay) {
slideNext();
} else if (loadingBar) {
var width = step * slideWidth / slideShowDelay;
loadingBar.width(width);
timerGlow.css({left: width - 100 + 'px'});
}
}
}
function slideNext() {
if (lock) return false;
var index = activeIndex;
index++;
if (index >= numItem && options.loop) {
index = 0;
slide(index);
} else if (index < numItem) {
slide(index);
}
}
function slidePrev() {
if (lock) return false;
var index = activeIndex;
index--;
if (index < 0 && options.loop) {
index = numItem - 1;
slide(index);
}
else if (index >= 0) {
slide(index);
}
}
function endMoveCaption(caption) {
var easeout = (caption.data("easeout")) ? caption.data("easeout") : "",
ieVersion = (!!window.ActiveXObject && +(/msie\s(\d+)/i.exec(navigator.userAgent)[1])) || NaN;
if (ieVersion != NaN)
ieVersion = 11;
else
ieVersion = parseInt(ieVersion);
clearTimeout(caption.data('timer-start'));
if (easeout != "" && easeout != "keep" && ieVersion <= 9)
caption.fadeOut();
else {
caption.removeClass(effectsIn.join(' '));
if (easeout != "") {
if (easeout == "random")
easeout = effectsOut[Math.floor(Math.random() * e_out_length)];
caption.addClass(easeout);
}
else
caption.hide();
}
}
function removeTheCaptions(oItem) {
oItem.find(".md-object").each(function () {
var caption = $(this);
caption.stop(true, true).hide();
clearTimeout(caption.data('timer-start'));
clearTimeout(caption.data('timer-stop'));
});
}
function animateTheCaptions(nextItem) {
$(".md-object", nextItem).each(function (boxIndex) {
var caption = $(this);
if (caption.data("easeout"))
caption.removeClass(effectsOut.join(' '));
var easein = caption.data("easein") ? caption.data("easein") : "",
ieVersion = (!!window.ActiveXObject && +(/msie\s(\d+)/i.exec(navigator.userAgent)[1])) || NaN;
if (ieVersion != NaN)
ieVersion = 11;
else
ieVersion = parseInt(ieVersion);
if (easein == "random")
easein = effectsIn[Math.floor(Math.random() * e_in_length)];
caption.removeClass(effectsIn.join(' '));
caption.hide();
if (caption.data("start") != undefined) {
caption.data('timer-start', setTimeout(function () {
if (easein != "" && ieVersion <= 9)
caption.fadeIn();
else
caption.show().addClass(easein);
}, caption.data("start")));
}
else
caption.show().addClass(easein);
if (caption.data("stop") != undefined) {
caption.data('timer-stop', setTimeout(function () {
endMoveCaption(caption);
}, caption.data('stop')));
}
});
}
//When Animation finishes
function transitionEnd() {
options.onEndTransition.call(self);
$('.md-strips-container', self).remove();
slideItems[oIndex].hide();
slideItems[activeIndex].show();
lock = false;
animateTheCaptions(slideItems[activeIndex]);
}
// Add strips
function addStrips(vertical, opts) {
var strip,
opts = (opts) ? opts : options,
stripsContainer = $(''),
stripWidth = Math.round(slideWidth / opts.strips),
stripHeight = Math.round(slideHeight / opts.strips),
$image = $(".md-mainimg img", slideItems[activeIndex]),
$overlay = $('.md-slider-overlay', slideItems[activeIndex]);
if ($overlay.length) {
var $temp = $('');
$temp.css({
'background-color' : $overlay.css('background-color')
});
stripsContainer.append ($temp);
}
if ($image.length == 0)
$image = $(".md-mainimg", slideItems[activeIndex]);
for (var i = 0; i < opts.strips; i++) {
var top = ((vertical) ? (stripHeight * i) + 'px' : '0px'),
left = ((vertical) ? '0px' : (stripWidth * i) + 'px'),
width, height;
if (i == opts.strips - 1) {
width = ((vertical) ? '0px' : (slideWidth - (stripWidth * i)) + 'px'),
height = ((vertical) ? (slideHeight - (stripHeight * i)) + 'px' : '0px');
} else {
width = ((vertical) ? '0px' : stripWidth + 'px'),
height = ((vertical) ? stripHeight + 'px' : '0px');
}
strip = $('').css({
width: width,
height: height,
top: top,
left: left,
opacity: 0
}).append($image.clone().css({
marginLeft: vertical ? 0 : -(i * stripWidth) + "px",
marginTop: vertical ? -(i * stripHeight) + "px" : 0
}));
stripsContainer.append(strip);
}
self.append(stripsContainer);
}
// Add strips
function addTiles(x, y, index) {
var tile;
var stripsContainer = $('');
var tileWidth = slideWidth / x,
tileHeight = slideHeight / y,
$image = $(".md-mainimg img", slideItems[index]),
$overlay = $('.md-slider-overlay', slideItems[index]);
if ($overlay.length) {
var $temp = $('');
$temp.css({
'background-color' : $overlay.css('background-color')
});
stripsContainer.append ($temp);
}
if ($image.length == 0)
$image = $(".md-mainimg", slideItems[index]);
for (var i = 0; i < y; i++) {
for (var j = 0; j < x; j++) {
var top = (tileHeight * i) + 'px',
left = (tileWidth * j) + 'px';
tile = $('').css({
width: tileWidth,
height: tileHeight,
top: top,
left: left
}).append($image.clone().css({
marginLeft: "-" + left,
marginTop: "-" + top
}));
stripsContainer.append(tile);
}
}
self.append(stripsContainer);
}
// Add strips
function addStrips2() {
var strip,
images = [],
stripsContainer = $(''),
$overlay = $('.md-slider-overlay', slideItems[activeIndex]);
if ($overlay.length) {
var $temp = $('');
$temp.css({
'background-color' : $overlay.css('background-color')
});
stripsContainer.append ($temp);
}
$(".md-mainimg img", slideItems[oIndex]), $(".md-mainimg img", slideItems[activeIndex]);
if ($(".md-mainimg img", slideItems[oIndex]).length > 0)
images.push($(".md-mainimg img", slideItems[oIndex]));
else
images.push($(".md-mainimg", slideItems[oIndex]));
if ($(".md-mainimg img", slideItems[activeIndex]).length > 0)
images.push($(".md-mainimg img", slideItems[activeIndex]));
else
images.push($(".md-mainimg", slideItems[activeIndex]));
for (var i = 0; i < 2; i++) {
strip = $('').css({
width: slideWidth,
height: slideHeight
}).append(images[i].clone());
stripsContainer.append(strip);
}
self.append(stripsContainer);
}
// Add strips
function addSlits(fx) {
var $stripsContainer = $(''),
$image = ($(".md-mainimg img", slideItems[oIndex]).length > 0) ? $(".md-mainimg img", slideItems[oIndex]) : $(".md-mainimg", slideItems[oIndex]),
$div1 = $('').append($image.clone()),
$div2 = $(''),
position = $image.position(),
$overlay = $('.md-slider-overlay', slideItems[activeIndex]);
if ($overlay.length) {
var $temp = $('');
$temp.css({
'background-color' : $overlay.css('background-color')
});
$stripsContainer.append ($temp);
}
$div2.append($image.clone().css("top", position.top - (slideHeight / 2) + "px"));
if (fx == "slit-vertical-down" || fx == "slit-vertical-up")
$div2 = $('').append($image.clone().css("left", position.left - (slideWidth / 2) + "px"));
$stripsContainer.append($div1).append($div2);
self.append($stripsContainer);
}
function runTransition(fx) {
switch (fx) {
case 'slit-horizontal-left-top':
case 'slit-horizontal-top-right':
case 'slit-horizontal-bottom-up':
case 'slit-vertical-down':
case 'slit-vertical-up':
addSlits(fx);
$(".md-object", slideItems[activeIndex]).hide();
slideItems[oIndex].hide();
slideItems[activeIndex].show();
var slice1 = $('.mdslider-slit', self).first(),
slice2 = $('.mdslider-slit', self).last();
var transitionProp = {
'transition': 'all ' + options.transitionsSpeed + 'ms ease-in-out',
'-webkit-transition': 'all ' + options.transitionsSpeed + 'ms ease-in-out',
'-moz-transition': 'all ' + options.transitionsSpeed + 'ms ease-in-out',
'-ms-transition': 'all ' + options.transitionsSpeed + 'ms ease-in-out'
};
$('.mdslider-slit', self).css(transitionProp);
setTimeout(function () {
slice1.addClass("md-trans-elems-1");
slice2.addClass("md-trans-elems-2");
}, 50);
setTimeout(function () {
options.onEndTransition.call(self);
$('.md-strips-container', self).remove();
lock = false;
animateTheCaptions(slideItems[activeIndex]);
}, options.transitionsSpeed);
break;
case 'strip-up-right':
case 'strip-up-left':
addTiles(options.stripCols, 1, activeIndex);
var strips = $('.mdslider-tile', self),
timeStep = options.transitionsSpeed / options.stripCols / 2,
speed = options.transitionsSpeed / 2;
if (fx == 'strip-up-right') strips = $('.mdslider-tile', self).reverse();
strips.css({
height: '1px',
bottom: '0px',
top: "auto"
});
strips.each(function (i) {
var strip = $(this);
setTimeout(function () {
strip.animate({
height: '100%',
opacity: '1.0'
}, speed, 'easeInOutQuart', function () {
if (i == options.stripCols - 1) transitionEnd();
});
}, i * timeStep);
});
break;
case 'strip-down-right':
case 'strip-down-left':
addTiles(options.stripCols, 1, activeIndex);
var strips = $('.mdslider-tile', self),
timeStep = options.transitionsSpeed / options.stripCols / 2,
speed = options.transitionsSpeed / 2;
if (fx == 'strip-down-right') strips = $('.mdslider-tile', self).reverse();
strips.css({
height: '1px',
top: '0px',
bottom: "auto"
});
strips.each(function (i) {
var strip = $(this);
setTimeout(function () {
strip.animate({
height: '100%',
opacity: '1.0'
}, speed, 'easeInOutQuart', function () {
if (i == options.stripCols - 1) transitionEnd();
});
}, i * timeStep);
});
break;
case 'strip-left-up':
case 'strip-left-down':
addTiles(1, options.stripRows, activeIndex);
var strips = $('.mdslider-tile', self),
timeStep = options.transitionsSpeed / options.stripRows / 2,
speed = options.transitionsSpeed / 2;
if (fx == 'strip-left-up') strips = $('.mdslider-tile', self).reverse();
strips.css({
width: '1px',
left: '0px',
right: "auto"
});
strips.each(function (i) {
var strip = $(this);
setTimeout(function () {
strip.animate({
width: '100%',
opacity: '1.0'
}, speed, 'easeInOutQuart', function () {
if (i == options.stripRows - 1) transitionEnd();
});
}, i * timeStep);
});
break;
case 'strip-right-up':
case 'strip-right-down':
addTiles(1, options.stripRows, activeIndex);
var strips = $('.mdslider-tile', self),
timeStep = options.transitionsSpeed / options.stripRows / 2,
speed = options.transitionsSpeed / 2;
if (fx == 'strip-left-right-up') strips = $('.mdslider-tile', self).reverse();
strips.css({
width: '1px',
left: 'auto',
right: "1px"
});
strips.each(function (i) {
var strip = $(this);
setTimeout(function () {
strip.animate({
width: '100%',
opacity: '1.0'
}, speed, 'easeInOutQuart', function () {
if (i == options.stripRows - 1) transitionEnd();
});
}, i * timeStep);
});
break;
case 'strip-right-left-up':
case 'strip-right-left-down':
addTiles(1, options.stripRows, oIndex);
slideItems[oIndex].hide();
slideItems[activeIndex].show();
var strips = $('.mdslider-tile', self),
timeStep = options.transitionsSpeed / options.stripRows,
speed = options.transitionsSpeed / 2;
if (fx == 'strip-right-left-up') strips = $('.mdslider-tile', self).reverse();
strips.filter(':odd').css({
width: '100%',
right: '0px',
left: "auto",
opacity: 1
}).end().filter(':even').css({
width: '100%',
right: 'auto',
left: "0px",
opacity: 1
});
;
strips.each(function (i) {
var strip = $(this);
var css = (i % 2 == 0) ? {
left: '-50%',
opacity: '0'
} : {right: '-50%', opacity: '0'};
setTimeout(function () {
strip.animate(css, speed, 'easeOutQuint', function () {
if (i == options.stripRows - 1) {
options.onEndTransition.call(self);
$('.md-strips-container', self).remove();
lock = false;
animateTheCaptions(slideItems[activeIndex]);
}
});
}, i * timeStep);
});
break;
case 'strip-up-down-right':
case 'strip-up-down-left':
addTiles(options.stripCols, 1, oIndex);
slideItems[oIndex].hide();
slideItems[activeIndex].show();
var strips = $('.mdslider-tile', self),
timeStep = options.transitionsSpeed / options.stripCols / 2,
speed = options.transitionsSpeed / 2;
if (fx == 'strip-up-down-right') strips = $('.mdslider-tile', self).reverse();
strips.filter(':odd').css({
height: '100%',
bottom: '0px',
top: "auto",
opacity: 1
}).end().filter(':even').css({
height: '100%',
bottom: 'auto',
top: "0px",
opacity: 1
});
;
strips.each(function (i) {
var strip = $(this);
var css = (i % 2 == 0) ? {
top: '-50%',
opacity: 0
} : {bottom: '-50%', opacity: 0};
setTimeout(function () {
strip.animate(css, speed, 'easeOutQuint', function () {
if (i == options.stripCols - 1) {
options.onEndTransition.call(self);
$('.md-strips-container', self).remove();
lock = false;
animateTheCaptions(slideItems[activeIndex]);
}
});
}, i * timeStep);
});
break;
case 'left-curtain':
addTiles(options.stripCols, 1, activeIndex);
var strips = $('.mdslider-tile', self),
width = slideWidth / options.stripCols,
timeStep = options.transitionsSpeed / options.stripCols / 2;
strips.each(function (i) {
var strip = $(this);
strip.css({left: width * i, width: 0, opacity: 0});
setTimeout(function () {
strip.animate({
width: width,
opacity: '1.0'
}, options.transitionsSpeed / 2, function () {
if (i == options.stripCols - 1) transitionEnd();
});
}, timeStep * i);
});
break;
case 'right-curtain':
addTiles(options.stripCols, 1, activeIndex);
var strips = $('.mdslider-tile', self).reverse(),
width = slideWidth / options.stripCols,
timeStep = options.transitionsSpeed / options.stripCols / 2;
strips.each(function (i) {
var strip = $(this);
strip.css({
right: width * i,
left: "auto",
width: 0,
opacity: 0
});
setTimeout(function () {
strip.animate({
width: width,
opacity: '1.0'
}, options.transitionsSpeed / 2, function () {
if (i == options.stripCols - 1) transitionEnd();
});
}, timeStep * i);
});
break;
case 'top-curtain':
addTiles(1, options.stripRows, activeIndex);
var strips = $('.mdslider-tile', self),
height = slideHeight / options.stripRows,
timeStep = options.transitionsSpeed / options.stripRows / 2;
strips.each(function (i) {
var strip = $(this);
strip.css({top: height * i, height: 0, opacity: 0});
setTimeout(function () {
strip.animate({
height: height,
opacity: '1.0'
}, options.transitionsSpeed / 2, function () {
if (i == options.stripRows - 1) transitionEnd();
});
}, timeStep * i);
});
break;
case 'bottom-curtain':
addTiles(1, options.stripRows, activeIndex);
var strips = $('.mdslider-tile', self).reverse(),
height = slideHeight / options.stripRows,
timeStep = options.transitionsSpeed / options.stripRows / 2;
strips.each(function (i) {
var strip = $(this);
strip.css({bottom: height * i, height: 0, opacity: 0});
setTimeout(function () {
strip.animate({
height: height,
opacity: '1.0'
}, options.transitionsSpeed / 2, function () {
if (i == options.stripRows - 1) transitionEnd();
});
}, timeStep * i);
});
break;
case 'slide-in-right':
var i = 0;
addStrips2();
var strips = $('.mdslider-strip', self);
strips.each(function () {
strip = $(this);
var left = i * slideWidth;
strip.css({
left: left
});
strip.animate({
left: left - slideWidth
}, options.transitionsSpeed, function () {
transitionEnd();
});
i++;
});
break;
case 'slide-in-left':
var i = 0;
addStrips2();
var strips = $('.mdslider-strip', self);
strips.each(function () {
strip = $(this);
var left = -i * slideWidth;
strip.css({
left: left
});
strip.animate({
left: slideWidth + left
}, (options.transitionsSpeed * 2), function () {
transitionEnd();
});
i++;
});
break;
case 'slide-in-up':
var i = 0;
addStrips2();
var strips = $('.mdslider-strip', self);
strips.each(function () {
strip = $(this);
var top = i * slideHeight;
strip.css({
top: top
});
strip.animate({
top: top - slideHeight
}, options.transitionsSpeed, function () {
transitionEnd();
});
i++;
});
break;
case 'slide-in-down':
var i = 0;
addStrips2();
var strips = $('.mdslider-strip', self);
strips.each(function () {
strip = $(this);
var top = -i * slideHeight;
strip.css({
top: top
});
strip.animate({
top: slideHeight + top
}, options.transitionsSpeed, function () {
transitionEnd();
});
i++;
});
break;
case 'fade':
default:
var opts = {
strips: 1
};
addStrips(false, opts);
var strip = $('.mdslider-strip:first', self);
strip.css({
'height': '100%',
'width': slideWidth
});
if (fx == 'slide-in-right') strip.css({
'height': '100%',
'width': slideWidth,
'left': slideWidth + 'px',
'right': ''
});
else if (fx == 'slide-in-left') strip.css({
'left': '-' + slideWidth + 'px'
});
strip.animate({
left: '0px',
opacity: 1
}, options.transitionsSpeed, function () {
transitionEnd();
});
break;
}
}
// Shuffle an array
function shuffle(oldArray) {
var newArray = oldArray.slice();
var len = newArray.length;
var i = len;
while (i--) {
var p = parseInt(Math.random() * len);
var t = newArray[i];
newArray[i] = newArray[p];
newArray[p] = t;
}
return newArray;
}
function documentHasTouch() {
return ('ontouchstart' in window || 'createTouch' in document);
}
function resizeWindow() {
wrap.width();
slideWidth = options.responsive ? wrap.width() : options.width;
if (options.responsive) {
if (options.fullwidth && slideWidth > options.width)
slideHeight = options.height;
else
slideHeight = Math.round(slideWidth / options.width * options.height);
}
if (!options.responsive && !options.fullwidth)
wrap.width(slideWidth);
if (!options.responsive && options.fullwidth)
wrap.css({"min-width": slideWidth + "px"});
if (options.fullwidth) {
$(".md-objects", self).width(options.width);
var bulletSpace = 20;
if ((wrap.width() - options.width) / 2 > 20)
bulletSpace = (wrap.width() - options.width) / 2;
wrap.find(".md-bullets").css({
'left': bulletSpace,
'right': bulletSpace
});
wrap.find(".md-thumb").css({
'left': bulletSpace,
'right': bulletSpace
});
}
if (options.responsive && options.fullwidth && (wrap.width() < options.width))
$(".md-objects", self).width(slideWidth);
wrap.height(slideHeight);
$(".md-slide-item", self).height(slideHeight);
resizeBackgroundImage();
resizeThumbDiv();
resizeFontSize();
resizePadding();
setThumnail()
}
function resizeBackgroundImage() {
$(".md-slide-item", self).each(function () {
var $background = $(".md-mainimg img", this);
if ($background.length == 1) {
if ($background.data("defW") && $background.data("defH")) {
var width = $background.data("defW"),
height = $background.data("defH");
//if( $(window).width() < 1200) {
changeImagePosition($background, width, height);
//}
}
}
else
$(".md-mainimg", $(this)).width($(".md-slide-item:visible", self).width()).height($(".md-slide-item:visible", self).height())
});
}
function preloadImages() {
var count = $(".md-slide-item .md-mainimg img", self).length;
self.data('count', count);
if (self.data('count') == 0)
slideReady();
$(".md-slide-item .md-mainimg img", self).each(function () {
$(this).load(function () {
var $image = $(this);
if (!$image.data('defW')) {
var dimensions = getImgSize($image.attr("src"));
if( $(window).width() < 1200) {
changeImagePosition($image, dimensions.width, dimensions.height);
}
$image.data({
'defW': dimensions.width,
'defH': dimensions.height
});
}
self.data('count', self.data('count') - 1);
if (self.data('count') == 0)
slideReady();
});
if (this.complete) $(this).load();
});
}
function slideReady() {
self.removeClass("loading-image");
setTimer();
}
function changeImagePosition($background, width, height) {
var panelWidth = $(".md-slide-item:visible", self).width(),
panelHeight = $(".md-slide-item:visible", self).height();
if (height > 0 && panelHeight > 0) {
if (((width / height) > (panelWidth / panelHeight))) {
var left = panelWidth - (panelHeight / height) * width;
$background.css({
width: "auto",
height: panelHeight + "px"
});
if (left < 0) {
$background.css({left: (left / 2) + "px", top: 0});
} else {
$background.css({left: 0, top: 0});
}
} else {
var top = panelHeight - (panelWidth / width) * height;
$background.css({width: panelWidth + "px", height: "100%"});
$background.css({top:0, left: 0});
}
}
}
function resizeFontSize() {
var fontDiff = 1;
if (parseInt($.browser.version, 10) < 9)
fontDiff = 6;
if (wrap.width() < options.width) {
$(".md-objects", self).css({'font-size': wrap.width() / options.width * 100 - fontDiff + '%'});
} else {
$(".md-objects", self).css({'font-size': 100 - fontDiff + '%'});
}
}
function resizePadding() {
if (wrap.width() < options.width && options.responsive) {
$(".md-objects div.md-object", self).each(function () {
var objectRatio = wrap.width() / options.width,
$_object = $(this),
objectPadding = {};
if ($_object.data('paddingtop'))
objectPadding['padding-top'] = $_object.data('paddingtop') * objectRatio;
if ($_object.data('paddingright'))
objectPadding['padding-right'] = $_object.data('paddingright') * objectRatio;
if ($_object.data('paddingbottom'))
objectPadding['padding-bottom'] = $_object.data('paddingbottom') * objectRatio;
if ($_object.data('paddingleft'))
objectPadding['padding-left'] = $_object.data('paddingleft') * objectRatio;
if ($('> a', $_object).length)
$('> a', $_object).css(objectPadding);
else
$_object.css(objectPadding);
})
}
else {
$(".md-objects div.md-object", self).each(function () {
var $_object = $(this),
objectPadding = {};
if ($_object.data('paddingtop'))
objectPadding['padding-top'] = $_object.data('paddingtop');
if ($_object.data('paddingtop'))
objectPadding['padding-top'] = $_object.data('paddingtop');
if ($_object.data('paddingright'))
objectPadding['padding-right'] = $_object.data('paddingright');
if ($_object.data('paddingbottom'))
objectPadding['padding-bottom'] = $_object.data('paddingbottom');
if ($_object.data('paddingleft')) objectPadding['padding-left'] = $_object.data('paddingleft');
if ($('> a', $_object).length)
$('> a', $_object).css(objectPadding);
else
$_object.css(objectPadding);
});
}
}
function setThumnail() {
if (options.showThumb && !options.showBullet) {
var thumbHeight = self.data('thumb-height');
if (options.posThumb == '1') {
var thumbBottom = thumbHeight / 2;
wrap.find(".md-thumb").css({
'height': thumbHeight + 10,
'bottom': -thumbBottom - 10
});
wrap.css({'margin-bottom': thumbBottom + 10})
}
else {
wrap.find(".md-thumb").css({
'height': thumbHeight + 10,
'bottom': -(thumbHeight + 40)
});
wrap.css({'margin-bottom': thumbHeight + 50})
}
}
}
function getImgSize(imgSrc) {
var newImg = new Image();
newImg.src = imgSrc;
var dimensions = {height: newImg.height, width: newImg.width};
return dimensions;
}
$(document).ready(function () {
init();
})
}
$.fn.reverse = [].reverse;
//Image Preloader Function
var ImagePreload = function (p_aImages, p_pfnPercent, p_pfnFinished) {
this.m_pfnPercent = p_pfnPercent;
this.m_pfnFinished = p_pfnFinished;
this.m_nLoaded = 0;
this.m_nProcessed = 0;
this.m_aImages = new Array;
this.m_nICount = p_aImages.length;
for (var i = 0; i < p_aImages.length; i++) this.Preload(p_aImages[i])
};
ImagePreload.prototype = {
Preload: function (p_oImage) {
var oImage = new Image;
this.m_aImages.push(oImage);
oImage.onload = ImagePreload.prototype.OnLoad;
oImage.onerror = ImagePreload.prototype.OnError;
oImage.onabort = ImagePreload.prototype.OnAbort;
oImage.oImagePreload = this;
oImage.bLoaded = false;
oImage.source = p_oImage;
oImage.src = p_oImage
},
OnComplete: function () {
this.m_nProcessed++;
if (this.m_nProcessed == this.m_nICount) this.m_pfnFinished();
else this.m_pfnPercent(Math.round((this.m_nProcessed / this.m_nICount) * 10))
},
OnLoad: function () {
this.bLoaded = true;
this.oImagePreload.m_nLoaded++;
this.oImagePreload.OnComplete()
},
OnError: function () {
this.bError = true;
this.oImagePreload.OnComplete()
},
OnAbort: function () {
this.bAbort = true;
this.oImagePreload.OnComplete()
}
}
$.fn.mdvideobox = function (opt) {
$(this).each(function () {
function init() {
if ($("#md-overlay").length == 0) {
var _overlay = $('').hide().click(closeMe);
var _container = $('');
_container.css({
'width': options.initialWidth + 'px',
'height': options.initialHeight + 'px',
'display': 'none'
});
$("#md-closebtn", _container).click(closeMe);
$("body").append(_overlay).append(_container);
}
overlay = $("#md-overlay");
container = $("#md-videocontainer");
videoembed = $("#md-video-embed", container);
caption = $(".md-caption", container);
element.click(activate);
}
function closeMe() {
overlay.fadeTo("fast", 0, function () {
$(this).css('display', 'none')
});
videoembed.html('');
container.hide();
return false;
}
function activate() {
options.click.call();
overlay.css({'height': $(window).height() + 'px'});
var top = ($(window).height() / 2) - (options.initialHeight / 2);
var left = ($(window).width() / 2) - (options.initialWidth / 2);
container.css({top: top, left: left}).show();
videoembed.css({
'background': '#fff url(css/loading.gif) no-repeat center',
'height': options.contentsHeight,
'width': options.contentsWidth
});
overlay.css('display', 'block').fadeTo("fast", options.defaultOverLayFade);
caption.html(title);
videoembed.fadeIn("slow", function () {
insert();
});
return false;
}
function insert() {
videoembed.css('background', '#fff');
embed = '';
videoembed.html(embed);
}
var options = $.extend({
initialWidth: 640,
initialHeight: 400,
contentsWidth: 640,
contentsHeight: 350,
defaultOverLayFade: 0.8,
click: function () {
}
}, opt);
var overlay, container, caption, videoembed, embed;
var element = $(this);
var videoSrc = element.attr("href");
var title = element.attr("title");
//lets start it
init();
});
}
})(jQuery);
;
/*! jQuery Migrate v1.2.1 | (c) 2005, 2013 jQuery Foundation, Inc. and other contributors | jquery.org/license */
jQuery.migrateMute===void 0&&(jQuery.migrateMute=!0),function(e,t,n){function r(n){var r=t.console;i[n]||(i[n]=!0,e.migrateWarnings.push(n),r&&r.warn&&!e.migrateMute&&(r.warn("JQMIGRATE: "+n),e.migrateTrace&&r.trace&&r.trace()))}function a(t,a,i,o){if(Object.defineProperty)try{return Object.defineProperty(t,a,{configurable:!0,enumerable:!0,get:function(){return r(o),i},set:function(e){r(o),i=e}}),n}catch(s){}e._definePropertyBroken=!0,t[a]=i}var i={};e.migrateWarnings=[],!e.migrateMute&&t.console&&t.console.log&&t.console.log("JQMIGRATE: Logging is active"),e.migrateTrace===n&&(e.migrateTrace=!0),e.migrateReset=function(){i={},e.migrateWarnings.length=0},"BackCompat"===document.compatMode&&r("jQuery is not compatible with Quirks Mode");var o=e("",{size:1}).attr("size")&&e.attrFn,s=e.attr,u=e.attrHooks.value&&e.attrHooks.value.get||function(){return null},c=e.attrHooks.value&&e.attrHooks.value.set||function(){return n},l=/^(?:input|button)$/i,d=/^[238]$/,p=/^(?:autofocus|autoplay|async|checked|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped|selected)$/i,f=/^(?:checked|selected)$/i;a(e,"attrFn",o||{},"jQuery.attrFn is deprecated"),e.attr=function(t,a,i,u){var c=a.toLowerCase(),g=t&&t.nodeType;return u&&(4>s.length&&r("jQuery.fn.attr( props, pass ) is deprecated"),t&&!d.test(g)&&(o?a in o:e.isFunction(e.fn[a])))?e(t)[a](i):("type"===a&&i!==n&&l.test(t.nodeName)&&t.parentNode&&r("Can't change the 'type' of an input or button in IE 6/7/8"),!e.attrHooks[c]&&p.test(c)&&(e.attrHooks[c]={get:function(t,r){var a,i=e.prop(t,r);return i===!0||"boolean"!=typeof i&&(a=t.getAttributeNode(r))&&a.nodeValue!==!1?r.toLowerCase():n},set:function(t,n,r){var a;return n===!1?e.removeAttr(t,r):(a=e.propFix[r]||r,a in t&&(t[a]=!0),t.setAttribute(r,r.toLowerCase())),r}},f.test(c)&&r("jQuery.fn.attr('"+c+"') may use property instead of attribute")),s.call(e,t,a,i))},e.attrHooks.value={get:function(e,t){var n=(e.nodeName||"").toLowerCase();return"button"===n?u.apply(this,arguments):("input"!==n&&"option"!==n&&r("jQuery.fn.attr('value') no longer gets properties"),t in e?e.value:null)},set:function(e,t){var a=(e.nodeName||"").toLowerCase();return"button"===a?c.apply(this,arguments):("input"!==a&&"option"!==a&&r("jQuery.fn.attr('value', val) no longer sets properties"),e.value=t,n)}};var g,h,v=e.fn.init,m=e.parseJSON,y=/^([^<]*)(<[\w\W]+>)([^>]*)$/;e.fn.init=function(t,n,a){var i;return t&&"string"==typeof t&&!e.isPlainObject(n)&&(i=y.exec(e.trim(t)))&&i[0]&&("<"!==t.charAt(0)&&r("$(html) HTML strings must start with '<' character"),i[3]&&r("$(html) HTML text after last tag is ignored"),"#"===i[0].charAt(0)&&(r("HTML string cannot start with a '#' character"),e.error("JQMIGRATE: Invalid selector string (XSS)")),n&&n.context&&(n=n.context),e.parseHTML)?v.call(this,e.parseHTML(i[2],n,!0),n,a):v.apply(this,arguments)},e.fn.init.prototype=e.fn,e.parseJSON=function(e){return e||null===e?m.apply(this,arguments):(r("jQuery.parseJSON requires a valid JSON string"),null)},e.uaMatch=function(e){e=e.toLowerCase();var t=/(chrome)[ \/]([\w.]+)/.exec(e)||/(webkit)[ \/]([\w.]+)/.exec(e)||/(opera)(?:.*version|)[ \/]([\w.]+)/.exec(e)||/(msie) ([\w.]+)/.exec(e)||0>e.indexOf("compatible")&&/(mozilla)(?:.*? rv:([\w.]+)|)/.exec(e)||[];return{browser:t[1]||"",version:t[2]||"0"}},e.browser||(g=e.uaMatch(navigator.userAgent),h={},g.browser&&(h[g.browser]=!0,h.version=g.version),h.chrome?h.webkit=!0:h.webkit&&(h.safari=!0),e.browser=h),a(e,"browser",e.browser,"jQuery.browser is deprecated"),e.sub=function(){function t(e,n){return new t.fn.init(e,n)}e.extend(!0,t,this),t.superclass=this,t.fn=t.prototype=this(),t.fn.constructor=t,t.sub=this.sub,t.fn.init=function(r,a){return a&&a instanceof e&&!(a instanceof t)&&(a=t(a)),e.fn.init.call(this,r,a,n)},t.fn.init.prototype=t.fn;var n=t(document);return r("jQuery.sub() is deprecated"),t},e.ajaxSetup({converters:{"text json":e.parseJSON}});var b=e.fn.data;e.fn.data=function(t){var a,i,o=this[0];return!o||"events"!==t||1!==arguments.length||(a=e.data(o,t),i=e._data(o,t),a!==n&&a!==i||i===n)?b.apply(this,arguments):(r("Use of jQuery.fn.data('events') is deprecated"),i)};var j=/\/(java|ecma)script/i,w=e.fn.andSelf||e.fn.addBack;e.fn.andSelf=function(){return r("jQuery.fn.andSelf() replaced by jQuery.fn.addBack()"),w.apply(this,arguments)},e.clean||(e.clean=function(t,a,i,o){a=a||document,a=!a.nodeType&&a[0]||a,a=a.ownerDocument||a,r("jQuery.clean() is deprecated");var s,u,c,l,d=[];if(e.merge(d,e.buildFragment(t,a).childNodes),i)for(c=function(e){return!e.type||j.test(e.type)?o?o.push(e.parentNode?e.parentNode.removeChild(e):e):i.appendChild(e):n},s=0;null!=(u=d[s]);s++)e.nodeName(u,"script")&&c(u)||(i.appendChild(u),u.getElementsByTagName!==n&&(l=e.grep(e.merge([],u.getElementsByTagName("script")),c),d.splice.apply(d,[s+1,0].concat(l)),s+=l.length));return d});var Q=e.event.add,x=e.event.remove,k=e.event.trigger,N=e.fn.toggle,T=e.fn.live,M=e.fn.die,S="ajaxStart|ajaxStop|ajaxSend|ajaxComplete|ajaxError|ajaxSuccess",C=RegExp("\\b(?:"+S+")\\b"),H=/(?:^|\s)hover(\.\S+|)\b/,A=function(t){return"string"!=typeof t||e.event.special.hover?t:(H.test(t)&&r("'hover' pseudo-event is deprecated, use 'mouseenter mouseleave'"),t&&t.replace(H,"mouseenter$1 mouseleave$1"))};e.event.props&&"attrChange"!==e.event.props[0]&&e.event.props.unshift("attrChange","attrName","relatedNode","srcElement"),e.event.dispatch&&a(e.event,"handle",e.event.dispatch,"jQuery.event.handle is undocumented and deprecated"),e.event.add=function(e,t,n,a,i){e!==document&&C.test(t)&&r("AJAX events should be attached to document: "+t),Q.call(this,e,A(t||""),n,a,i)},e.event.remove=function(e,t,n,r,a){x.call(this,e,A(t)||"",n,r,a)},e.fn.error=function(){var e=Array.prototype.slice.call(arguments,0);return r("jQuery.fn.error() is deprecated"),e.splice(0,0,"error"),arguments.length?this.bind.apply(this,e):(this.triggerHandler.apply(this,e),this)},e.fn.toggle=function(t,n){if(!e.isFunction(t)||!e.isFunction(n))return N.apply(this,arguments);r("jQuery.fn.toggle(handler, handler...) is deprecated");var a=arguments,i=t.guid||e.guid++,o=0,s=function(n){var r=(e._data(this,"lastToggle"+t.guid)||0)%o;return e._data(this,"lastToggle"+t.guid,r+1),n.preventDefault(),a[r].apply(this,arguments)||!1};for(s.guid=i;a.length>o;)a[o++].guid=i;return this.click(s)},e.fn.live=function(t,n,a){return r("jQuery.fn.live() is deprecated"),T?T.apply(this,arguments):(e(this.context).on(t,this.selector,n,a),this)},e.fn.die=function(t,n){return r("jQuery.fn.die() is deprecated"),M?M.apply(this,arguments):(e(this.context).off(t,this.selector||"**",n),this)},e.event.trigger=function(e,t,n,a){return n||C.test(e)||r("Global events are undocumented and deprecated"),k.call(this,e,t,n||document,a)},e.each(S.split("|"),function(t,n){e.event.special[n]={setup:function(){var t=this;return t!==document&&(e.event.add(document,n+"."+e.guid,function(){e.event.trigger(n,null,t,!0)}),e._data(this,n,e.guid++)),!1},teardown:function(){return this!==document&&e.event.remove(document,n+"."+e._data(this,n)),!1}}})}(jQuery,window);;
/* Modernizr 2.6.2 (Custom Build) | MIT & BSD
* Build: http://modernizr.com/download/#-csstransforms3d-csstransitions-touch-shiv-cssclasses-prefixed-teststyles-testprop-testallprops-prefixes-domprefixes-load
*/
;window.Modernizr=function(a,b,c){function z(a){j.cssText=a}function A(a,b){return z(m.join(a+";")+(b||""))}function B(a,b){return typeof a===b}function C(a,b){return!!~(""+a).indexOf(b)}function D(a,b){for(var d in a){var e=a[d];if(!C(e,"-")&&j[e]!==c)return b=="pfx"?e:!0}return!1}function E(a,b,d){for(var e in a){var f=b[a[e]];if(f!==c)return d===!1?a[e]:B(f,"function")?f.bind(d||b):f}return!1}function F(a,b,c){var d=a.charAt(0).toUpperCase()+a.slice(1),e=(a+" "+o.join(d+" ")+d).split(" ");return B(b,"string")||B(b,"undefined")?D(e,b):(e=(a+" "+p.join(d+" ")+d).split(" "),E(e,b,c))}var d="2.6.2",e={},f=!0,g=b.documentElement,h="modernizr",i=b.createElement(h),j=i.style,k,l={}.toString,m=" -webkit- -moz- -o- -ms- ".split(" "),n="Webkit Moz O ms",o=n.split(" "),p=n.toLowerCase().split(" "),q={},r={},s={},t=[],u=t.slice,v,w=function(a,c,d,e){var f,i,j,k,l=b.createElement("div"),m=b.body,n=m||b.createElement("body");if(parseInt(d,10))while(d--)j=b.createElement("div"),j.id=e?e[d]:h+(d+1),l.appendChild(j);return f=["",'"].join(""),l.id=h,(m?l:n).innerHTML+=f,n.appendChild(l),m||(n.style.background="",n.style.overflow="hidden",k=g.style.overflow,g.style.overflow="hidden",g.appendChild(n)),i=c(l,a),m?l.parentNode.removeChild(l):(n.parentNode.removeChild(n),g.style.overflow=k),!!i},x={}.hasOwnProperty,y;!B(x,"undefined")&&!B(x.call,"undefined")?y=function(a,b){return x.call(a,b)}:y=function(a,b){return b in a&&B(a.constructor.prototype[b],"undefined")},Function.prototype.bind||(Function.prototype.bind=function(b){var c=this;if(typeof c!="function")throw new TypeError;var d=u.call(arguments,1),e=function(){if(this instanceof e){var a=function(){};a.prototype=c.prototype;var f=new a,g=c.apply(f,d.concat(u.call(arguments)));return Object(g)===g?g:f}return c.apply(b,d.concat(u.call(arguments)))};return e}),q.touch=function(){var c;return"ontouchstart"in a||a.DocumentTouch&&b instanceof DocumentTouch?c=!0:w(["@media (",m.join("touch-enabled),("),h,")","{#modernizr{top:9px;position:absolute}}"].join(""),function(a){c=a.offsetTop===9}),c},q.csstransforms3d=function(){var a=!!F("perspective");return a&&"webkitPerspective"in g.style&&w("@media (transform-3d),(-webkit-transform-3d){#modernizr{left:9px;position:absolute;height:3px;}}",function(b,c){a=b.offsetLeft===9&&b.offsetHeight===3}),a},q.csstransitions=function(){return F("transition")};for(var G in q)y(q,G)&&(v=G.toLowerCase(),e[v]=q[G](),t.push((e[v]?"":"no-")+v));return e.addTest=function(a,b){if(typeof a=="object")for(var d in a)y(a,d)&&e.addTest(d,a[d]);else{a=a.toLowerCase();if(e[a]!==c)return e;b=typeof b=="function"?b():b,typeof f!="undefined"&&f&&(g.className+=" "+(b?"":"no-")+a),e[a]=b}return e},z(""),i=k=null,function(a,b){function k(a,b){var c=a.createElement("p"),d=a.getElementsByTagName("head")[0]||a.documentElement;return c.innerHTML="x",d.insertBefore(c.lastChild,d.firstChild)}function l(){var a=r.elements;return typeof a=="string"?a.split(" "):a}function m(a){var b=i[a[g]];return b||(b={},h++,a[g]=h,i[h]=b),b}function n(a,c,f){c||(c=b);if(j)return c.createElement(a);f||(f=m(c));var g;return f.cache[a]?g=f.cache[a].cloneNode():e.test(a)?g=(f.cache[a]=f.createElem(a)).cloneNode():g=f.createElem(a),g.canHaveChildren&&!d.test(a)?f.frag.appendChild(g):g}function o(a,c){a||(a=b);if(j)return a.createDocumentFragment();c=c||m(a);var d=c.frag.cloneNode(),e=0,f=l(),g=f.length;for(;e",f="hidden"in a,j=a.childNodes.length==1||function(){b.createElement("a");var a=b.createDocumentFragment();return typeof a.cloneNode=="undefined"||typeof a.createDocumentFragment=="undefined"||typeof a.createElement=="undefined"}()}catch(c){f=!0,j=!0}})();var r={elements:c.elements||"abbr article aside audio bdi canvas data datalist details figcaption figure footer header hgroup mark meter nav output progress section summary time video",shivCSS:c.shivCSS!==!1,supportsUnknownElements:j,shivMethods:c.shivMethods!==!1,type:"default",shivDocument:q,createElement:n,createDocumentFragment:o};a.html5=r,q(b)}(this,b),e._version=d,e._prefixes=m,e._domPrefixes=p,e._cssomPrefixes=o,e.testProp=function(a){return D([a])},e.testAllProps=F,e.testStyles=w,e.prefixed=function(a,b,c){return b?F(a,b,c):F(a,"pfx")},g.className=g.className.replace(/(^|\s)no-js(\s|$)/,"$1$2")+(f?" js "+t.join(" "):""),e}(this,this.document),function(a,b,c){function d(a){return"[object Function]"==o.call(a)}function e(a){return"string"==typeof a}function f(){}function g(a){return!a||"loaded"==a||"complete"==a||"uninitialized"==a}function h(){var a=p.shift();q=1,a?a.t?m(function(){("c"==a.t?B.injectCss:B.injectJs)(a.s,0,a.a,a.x,a.e,1)},0):(a(),h()):q=0}function i(a,c,d,e,f,i,j){function k(b){if(!o&&g(l.readyState)&&(u.r=o=1,!q&&h(),l.onload=l.onreadystatechange=null,b)){"img"!=a&&m(function(){t.removeChild(l)},50);for(var d in y[c])y[c].hasOwnProperty(d)&&y[c][d].onload()}}var j=j||B.errorTimeout,l=b.createElement(a),o=0,r=0,u={t:d,s:c,e:f,a:i,x:j};1===y[c]&&(r=1,y[c]=[]),"object"==a?l.data=c:(l.src=c,l.type=a),l.width=l.height="0",l.onerror=l.onload=l.onreadystatechange=function(){k.call(this,r)},p.splice(e,0,u),"img"!=a&&(r||2===y[c]?(t.insertBefore(l,s?null:n),m(k,j)):y[c].push(l))}function j(a,b,c,d,f){return q=0,b=b||"j",e(a)?i("c"==b?v:u,a,b,this.i++,c,d,f):(p.splice(this.i++,0,a),1==p.length&&h()),this}function k(){var a=B;return a.loader={load:j,i:0},a}var l=b.documentElement,m=a.setTimeout,n=b.getElementsByTagName("script")[0],o={}.toString,p=[],q=0,r="MozAppearance"in l.style,s=r&&!!b.createRange().compareNode,t=s?l:n.parentNode,l=a.opera&&"[object Opera]"==o.call(a.opera),l=!!b.attachEvent&&!l,u=r?"object":l?"script":"img",v=l?"script":u,w=Array.isArray||function(a){return"[object Array]"==o.call(a)},x=[],y={},z={timeout:function(a,b){return b.length&&(a.timeout=b[0]),a}},A,B;B=function(a){function b(a){var a=a.split("!"),b=x.length,c=a.pop(),d=a.length,c={url:c,origUrl:c,prefixes:a},e,f,g;for(f=0;f= config.min_move_x) {
cancelTouch();
if (dx > 0) {
config.wipeLeft()
} else {
config.wipeRight()
}
} else if (Math.abs(dy) >= config.min_move_y) {
cancelTouch();
if (dy > 0) {
config.wipeDown()
} else {
config.wipeUp()
}
}
}
}
function onTouchStart(e) {
if (e.touches.length == 1) {
startX = e.touches[0].pageX;
startY = e.touches[0].pageY;
isMoving = true;
this.addEventListener('touchmove', onTouchMove, false)
}
}
if ('ontouchstart' in document.documentElement) {
this.addEventListener('touchstart', onTouchStart, false)
}
});
return this
}
})(jQuery);;
jQuery.base64 = ( function( $ ) {
var _PADCHAR = "=",
_ALPHA = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",
_VERSION = "1.0";
function _getbyte64( s, i ) {
// This is oddly fast, except on Chrome/V8.
// Minimal or no improvement in performance by using a
// object with properties mapping chars to value (eg. 'A': 0)
var idx = _ALPHA.indexOf( s.charAt( i ) );
if ( idx === -1 ) {
throw "Cannot decode base64";
}
return idx;
}
function _decode(s) {
var pads = 0,
i,
b10,
imax = s.length,
x = [];
s = String( s );
if ( imax === 0 ) {
return s;
}
if ( imax % 4 !== 0 ) {
throw "Cannot decode base64";
}
if ( s.charAt( imax - 1 ) === _PADCHAR ) {
pads = 1;
if ( s.charAt( imax - 2 ) === _PADCHAR ) {
pads = 2;
}
// either way, we want to ignore this last block
imax -= 4;
}
for ( i = 0; i < imax; i += 4 ) {
b10 = ( _getbyte64( s, i ) << 18 ) | ( _getbyte64( s, i + 1 ) << 12 ) | ( _getbyte64( s, i + 2 ) << 6 ) | _getbyte64( s, i + 3 );
x.push( String.fromCharCode( b10 >> 16, ( b10 >> 8 ) & 0xff, b10 & 0xff ) );
}
switch ( pads ) {
case 1:
b10 = ( _getbyte64( s, i ) << 18 ) | ( _getbyte64( s, i + 1 ) << 12 ) | ( _getbyte64( s, i + 2 ) << 6 );
x.push( String.fromCharCode( b10 >> 16, ( b10 >> 8 ) & 0xff ) );
break;
case 2:
b10 = ( _getbyte64( s, i ) << 18) | ( _getbyte64( s, i + 1 ) << 12 );
x.push( String.fromCharCode( b10 >> 16 ) );
break;
}
return x.join( "" );
}
function _getbyte( s, i ) {
var x = s.charCodeAt( i );
if ( x > 255 ) {
throw "INVALID_CHARACTER_ERR: DOM Exception 5";
}
return x;
}
function _encode( s ) {
if ( arguments.length !== 1 ) {
throw "SyntaxError: exactly one argument required";
}
s = String( s );
var i,
b10,
x = [],
imax = s.length - s.length % 3;
if ( s.length === 0 ) {
return s;
}
for ( i = 0; i < imax; i += 3 ) {
b10 = ( _getbyte( s, i ) << 16 ) | ( _getbyte( s, i + 1 ) << 8 ) | _getbyte( s, i + 2 );
x.push( _ALPHA.charAt( b10 >> 18 ) );
x.push( _ALPHA.charAt( ( b10 >> 12 ) & 0x3F ) );
x.push( _ALPHA.charAt( ( b10 >> 6 ) & 0x3f ) );
x.push( _ALPHA.charAt( b10 & 0x3f ) );
}
switch ( s.length - imax ) {
case 1:
b10 = _getbyte( s, i ) << 16;
x.push( _ALPHA.charAt( b10 >> 18 ) + _ALPHA.charAt( ( b10 >> 12 ) & 0x3F ) + _PADCHAR + _PADCHAR );
break;
case 2:
b10 = ( _getbyte( s, i ) << 16 ) | ( _getbyte( s, i + 1 ) << 8 );
x.push( _ALPHA.charAt( b10 >> 18 ) + _ALPHA.charAt( ( b10 >> 12 ) & 0x3F ) + _ALPHA.charAt( ( b10 >> 6 ) & 0x3f ) + _PADCHAR );
break;
}
return x.join( "" );
}
return {
decode: _decode,
encode: _encode,
VERSION: _VERSION
};
}( jQuery ) );
(function($){
$(document).ready(function() {
//Functions
fullWidthBox();
scrollMenu();
tabs();
accordions();
modernGallery();
animations();
chart();
//formStylization();
addReview();
zoom();
paralax();
videoBg();
loadingButton();
productLimited();
blurPage();
wordRotate();
locationSocialFeed();
owlcarousel_slide();
google_map();
Counting();
//Menu > Sidebar
$('.menu .parent:not(".active") a').next('.sub').css('display', 'none');
$('.menu .parent a .open-sub').click(function(event){
event.preventDefault();
if ($(this).closest('.parent').hasClass('active')) {
$(this).parent().next('.sub').slideUp(600);
$(this).closest('.parent').removeClass('active');
} else {
$(this).parent().next('.sub').slideDown(600);
$(this).closest('.parent').addClass('active');
}
});
});
//Calculating The Browser Scrollbar Width
var parent, child, scrollWidth, bodyWidth;
if (scrollWidth === undefined) {
parent = jQuery('').appendTo('body');
child = parent.children();
scrollWidth = child.innerWidth() - child.height(99).innerWidth();
parent.remove();
}
//Form Stylization
function formStylization() {
var $ = jQuery,
radio = 'input[type="radio"]:not(.no-styles)',
checkbox = 'input[type="checkbox"]:not(.no-styles)';
$(radio).wrap('');
$('.new-radio').append('');
$(checkbox).wrap('');
$('.new-checkbox').append('');
$(checkbox + ':checked').parent('.new-checkbox').addClass('checked');
$(radio + ':checked').parent('.new-radio').addClass('checked');
$(checkbox + ':disabled').parent().addClass('disabled');
$(radio + ':disabled').parent().addClass('disabled');
$('html').click(function(){
$(radio).parent('.new-radio').removeClass('checked');
$(radio + ':checked').parent('.new-radio').addClass('checked');
$(checkbox).parent('.new-checkbox').removeClass('checked');
$(checkbox + ':checked').parent('.new-checkbox').addClass('checked');
$(radio).parent().removeClass('disabled');
$(checkbox).parent().removeClass('disabled');
$(radio + ':disabled').parent().addClass('disabled');
$(checkbox + ':disabled').parent().addClass('disabled');
});
if(typeof($.fn.selectBox) !== 'undefined') {
$('select:not(".without-styles")').selectBox();
}
}
//Full Width Box
function fullWidthBox() {
var $ = jQuery;
if ($('.full-width-box.auto-width').length) {
var windowWidth = $('body').outerWidth(),
containerWidth = $('.header .container').width();
$('.full-width-box.auto-width').each(function() {
$(this)
.css({
left : ( containerWidth - windowWidth) / 2,
width : windowWidth
})
.addClass('loaded');
});
}
}
//Animations
function animations() {
var $ = jQuery;
$('[data-appear-animation]').each(function() {
var $this = $(this);
$this.addClass('appear-animation');
if(($('body').width() + scrollWidth) > 767) {
$this.appear(function() {
var delay = ($this.attr('data-appear-animation-delay') ? $this.attr('data-appear-animation-delay') : 1);
if(delay > 1) $this.css('animation-delay', delay + 'ms');
$this.addClass($this.attr('data-appear-animation'));
setTimeout(function() {
$this.addClass('animated');
}, delay);
}, {accX: 0, accY: -150});
} else {
$this.addClass('animated');
}
});
/* Animation Progress Bars */
$('[data-appear-progress-animation]').each(function() {
var $this = $(this);
$this.appear(function() {
var delay = ($this.attr('data-appear-animation-delay') ? $this.attr('data-appear-animation-delay') : 1);
if(delay > 1) $this.css('animation-delay', delay + 'ms');
$this.find('.progress-bar').addClass($this.attr('data-appear-animation'));
setTimeout(function() {
$this.find('.progress-bar').animate({
width: $this.attr('data-appear-progress-animation')
}, 500, 'easeInCirc', function() {
$this.find('.progress-bar').animate({
textIndent: 10
}, 1500, 'easeOutBounce');
});
}, delay);
}, {accX: 0, accY: -50});
});
}
var stop_duplicate = 0;
//One Page
function scrollMenu() {
var $ = jQuery,
link = $('a.scroll'),
header = $('.header'),
headerHeight = header.height();
if(($('body').width() + scrollWidth) < 991) {
headerHeight = 0;
}
$(document).on('scroll', onScroll);
link.on('click', function(e) {
var target = $(this).attr('href'),
$this = $(this);
e.preventDefault();
link.removeClass('active');
$this.addClass('active');
if ($(target).length) {
$('html, body').animate({scrollTop: $(target).offset().top - headerHeight}, 600);
}
});
function onScroll(){
var scrollPos = $(document).scrollTop();
link.each(function () {
var currLink = $(this),
refElement = $(currLink.attr('href'));
if (
refElement.position().top - headerHeight <= scrollPos &&
refElement.position().top + refElement.height() > scrollPos) {
link.removeClass('active');
currLink.addClass('active');
} else {
currLink.removeClass('active');
}
});
}
}
//Accordion
function accordions() {
var $ = jQuery;
//Some open
$('.multi-collapse .collapse').collapse({
toggle: false
});
//Always open
$('.panel a[data-toggle="collapse"]').click( function(event){
event.preventDefault();
if ($(this).closest('.panel').hasClass('active')) {
if ($(this).closest('.panel-group').hasClass('one-open')) {
event.stopPropagation();
}
}
});
$('.collapse').on('hide.bs.collapse', function (event) {
event.stopPropagation();
$(this).closest('.panel').removeClass('active');
});
$('.collapse').on('show.bs.collapse', function () {
$(this).closest('.panel').addClass('active');
});
$('.collapse.in').closest('.panel').addClass('active');
}
//Tabs
function tabs() {
var $ = jQuery,
tab = $('.nav-tabs');
tab.find('a').click(function (e) {
// e.preventDefault();
$(this).tab('show');
});
if (($('body').width() + scrollWidth) < 768 && (!tab.hasClass('no-responsive')))
{
tab.each(function(){
var $this = $(this);
if (!$this.next('.tab-content').hasClass('hidden') && !$this.find('li').hasClass('dropdown')) {
$this.addClass('accordion-tab');
$this.find('a').each(function(){
var $this = $(this),
id = $this.attr('href');
$this.prepend('');
$this.closest('.nav-tabs').next('.tab-content').find(id)
.appendTo($this.closest('li'));
});
$this.next('.tab-content').addClass('hidden');
}
});
$('.accordion-tab > li.active .tab-pane').slideDown();
}
else
{
tab.find('.tab-pane').removeAttr('style', 'display');
tab.each(function(){
var $this = $(this);
if ($this.next('.tab-content').hasClass('hidden')) {
$this.removeClass('accordion-tab');
$this.find('a').each(function(){
var $this = $(this),
id = $this.attr('href');
$($this.closest('li').find('.tab-pane'))
.appendTo($this.closest('.nav-tabs').next('.tab-content'));
});
$this.next('.tab-content').removeClass('hidden');
}
});
}
$('.accordion-tab > li > a').on('shown.bs.tab', function (e) {
if (($('body').width() + scrollWidth) < 768) {
var $this = $(this),
tab = $this.closest('li');
e.preventDefault();
$this
.closest('.accordion-tab')
.find('.tab-pane').not(tab.find('.tab-pane'))
.removeClass('active')
.slideUp();
tab.find('.tab-pane')
.addClass('active')
.slideDown();
$('html, body').on("scroll mousedown DOMMouseScroll mousewheel keyup", function(){
$('html, body').stop();
});
setTimeout(function(){
$('html, body').animate({
scrollTop: $this.offset().top
}, 800);
}, 500 );
}
});
}
//Slider
function openItem( $item ) {
var $ = jQuery;
$item.addClass('active');
$item.stop().children('.slid-content').animate({
opacity: 1
});
}
function progressiveSlider() {
var $ = jQuery,
parameters,
slider = $('.progressive-slider');
slider.each(function () {
var $this = $(this);
if ($this.hasClass('progressive-slider-two')) {
parameters = {
responsive : true,
auto : true,
pagination : $(this).closest('.slider').find('.pagination'),
scroll : {
duration : 1000,
pauseOnHover : true
},
items : {
visible : 1,
},
swipe : {
onMouse : false,
onTouch : true
},
onCreate : function( data ) {
$this.find('.slider-wrapper').css('height', data.height)
}
}
} else if ($this.hasClass('progressive-slider-three')) {
parameters = {
width : '100%',
responsive : true,
auto : true,
items : {
visible : 1,
},
scroll : {
fx : 'crossfade',
duration : 1000,
pauseOnHover : true
},
swipe : {
onMouse: false,
onTouch: true
}
}
} else if ($this.hasClass('progressive-slider-four')) {
parameters = {
width : '100%',
responsive : true,
auto : true,
items : {
visible : 1,
},
scroll : {
duration : 1000,
pauseOnHover : true
},
next : $(this).closest('.slider').find('.next'),
prev : $(this).closest('.slider').find('.prev'),
swipe : {
onMouse: false,
onTouch: true
}
}
} else {
parameters = {
width : '100%',
responsive : true,
scroll : {
fx : 'crossfade',
duration : 700,
onBefore : function( data ) {
data.items.old.stop().children('.slid-content').animate({
opacity: 0
});
},
onAfter : function( data ) {
openItem( data.items.visible );
}
},
auto : false,
next : $(this).closest('.slider').find('.next'),
prev : $(this).closest('.slider').find('.prev'),
pagination : $(this).closest('.slider').find('.pagination'),
items : {
visible : 1,
},
swipe : {
onMouse: false,
onTouch: true
},
onCreate : function( data ) {
openItem(data.items);
}
}
}
});
slider.find('.sliders-box').each(function () {
$(this).carouFredSel(parameters).parents('.slider').removeClass('load');
});
}
//Banner set
function bannerSetCarousel() {
var $ = jQuery;
$('.banner-set .banners').each(function () {
var bannerSet = $(this).closest('.banner-set'),
prev = bannerSet.find('.prev'),
next = bannerSet.find('.next'),
height;
$(this).carouFredSel({
auto : false,
width : '100%',
responsive : false,
infinite : false,
next : next,
prev : prev,
pagination : bannerSet.find('.pagination'),
swipe : {
onMouse : false,
onTouch : true
},
scroll: 1,
onCreate: function () {
height = $(this).height();
$(this).find('.banner').css({
height : height
});
if (bannerSet.hasClass('banner-set-mini') && bannerSet.hasClass('banner-set-no-pagination')) {
$(this).closest('.banner-set').find('.prev, .next').css({
marginTop : -((height / 2) + 7)
});
}
}
}).parents('.banner-set').removeClass('load');
});
}
//Carousel
function carousel() {
var $ = jQuery;
if ($('.carousel-box .carousel').length) {
var carouselBox = $('.carousel-box .carousel');
carouselBox.each(function () {
var carousel = $(this).closest('.carousel-box'),
swipe,
autoplay,
prev,
next,
pagitation,
responsive = false;
if (carousel.hasClass('no-swipe')) {
swipe = false;
} else {
swipe = true;
}
if (carousel.attr('data-carousel-autoplay') == 'true') {
autoplay = true;
} else {
autoplay = false;
}
if (carousel.attr('data-carousel-nav') == 'false') {
next = false;
prev = false;
carousel.addClass('no-nav');
} else {
next = carousel.find('.next');
prev = carousel.find('.prev');
carousel.removeClass('no-nav');
}
if (carousel.attr('data-carousel-pagination') == 'true') {
pagination = carousel.find('.pagination');
carousel.removeClass('no-pagination');
} else {
pagination = false;
carousel.addClass('no-pagination');
}
if (carousel.attr('data-carousel-one') == 'true') {
responsive = true;
}
duration_speed = carousel.attr('data-duration') ? carousel.attr('data-duration') : 1000;
$(this).carouFredSel({
onCreate : function () {
$(window).on('resize', function(event){
event.stopPropagation();
});
},
auto : autoplay,
width : '100%',
infinite : false,
next : next,
prev : prev,
pagination : pagination,
responsive : responsive,
swipe : {
onMouse : false,
onTouch : swipe
},
scroll : {
items : 1,
duration : parseInt(duration_speed),
pauseOnHover : true
}
}).parents('.carousel-box').removeClass('load');
});
}
}
function thumblist() {
var $ = jQuery;
if ($('#thumblist').length) {
$('#thumblist').carouFredSel({
prev : '.thumblist-box .prev',
next : '.thumblist-box .next',
width : '100%',
auto : false,
swipe : {
onMouse : false,
onTouch : true
}
}).parents('.thumblist-box').removeClass('load');
}
}
// Owlcarousel
function owlcarousel_slide()
{
$('.jvCarousel').each(function(index,item){
var jv_autoplay = $(this).attr('data-autoplay');
var jv_transition = $(this).attr('data-transitionstyle');
var jv_items = $(this).attr('data-items');
var jv_desktop = $(this).attr('data-itemsdesktop');
var jv_desktopSmall = $(this).attr('data-itemsdesktopsmall');
var jv_tablet = $(this).attr('data-itemstablet');
var jv_mobile = $(this).attr('data-itemsmobile');
var jv_singleItem = $(this).attr('data-singleitem');
var jv_navigation = $(this).attr('data-navigation');
var jv_pagination = $(this).attr('data-pagination');
var jv_next_navi = ($(this).attr('data-nexttext') !== undefined) ? $.base64.decode($(this).attr('data-nexttext')) : 'undefined';
var jv_prev_navi = ($(this).attr('data-prevtext') !== undefined) ? $.base64.decode($(this).attr('data-prevtext')) : 'undefined';
$(this).owlCarousel({
autoplay:jv_autoplay,
loop:true,
transitionStyle : (jv_transition !== 'undefined') ? jv_transition : false,
items: jv_items,
itemsDesktop: [1199,jv_desktop],
itemsDesktopSmall: [979,jv_desktopSmall],
itemsTablet: [768,jv_tablet],
itemsMobile: [479,jv_mobile],
singleItem : $.parseJSON(jv_singleItem),
navigation: $.parseJSON(jv_navigation),
navigationText: ( jv_next_navi !== "undefined" && jv_prev_navi !== "undefined") ? [jv_prev_navi.split('|{').join('<').split('|}').join('>'),jv_next_navi.split('|{').join('<').split('|}').join('>')] : false,
pagination: $.parseJSON(jv_pagination),
mouseDrag: true,
touchDrag: true
});
});
}
//Modern Gallery
function modernGallery() {
var $ = jQuery;
if(typeof($.fn.imagesLoaded) !== 'undefined') {
var $container = $('#gallery-modern'),
bodyWidth = $('body').width();
$container.imagesLoaded( function() {
if ((bodyWidth + scrollWidth) >= 1200) {
$container.masonry({
columnWidth: 300,
itemSelector: '.images-box'
});
} else if ((bodyWidth + scrollWidth) <= 1199 && (bodyWidth + scrollWidth) ) {
$container.masonry({
columnWidth: 242.5,
itemSelector: '.images-box'
});
} else if ((bodyWidth + scrollWidth) <= 979 && (bodyWidth + scrollWidth) >= 768 ) {
$container.masonry({
columnWidth: 187.5,
itemSelector: '.images-box'
});
}
});
}
}
//Chart
function chart() {
var $ = jQuery;
$('.chart').each(function () {
console.log($this);
var $this = $(this),
line = [],
type = 'line',
width = '100%',
height = '225',
lineColor = '#e1e1e1',
fillColor = 'rgba(0, 0, 0, .05)',
spotColor = '#a9a8a8',
minSpotColor = '#c6c6c6',
maxSpotColor = '#727070',
verticalLineColor = '#e1e1e1',
spotColorHovered = '#1e1e1e',
lineWidth = 2,
barSpacing = 8,
barWidth = 18,
barColor = 'rgba(0, 0, 0, .2)',
offset = 0,
sliceColors = [],
colorMap = [],
rangeColors = ['#d3dafe', '#a8b6ff', '#7f94ff'],
posBarColor = '#c6c6c6',
negBarColor = '#727070',
zeroBarColor = '#a9a8a8',
performanceColor = '#575656',
targetWidth = 5,
targetColor = '#1e1e1e';
if ($this.attr('data-line') !== undefined && $this.attr('data-line') !== false) {
line = $this.attr('data-line').split(/,/);
}
if ($this.attr('data-height') !== undefined && $this.attr('data-height') !== false) {
height = $this.attr('data-height');
}
if ($this.attr('data-line-width') !== undefined && $this.attr('data-line-width') !== false) {
lineWidth = $this.attr('data-line-width');
}
if ($this.attr('data-line-color') !== undefined && $this.attr('data-line-color') !== false) {
lineColor = $this.attr('data-line-color');
}
if ($this.attr('data-vertical-line-color') !== undefined && $this.attr('data-vertical-line-color') !== false) {
verticalLineColor = $this.attr('data-vertical-line-color');
}
if ($this.attr('data-spot-color-hovered') !== undefined && $this.attr('data-spot-color-hovered') !== false) {
spotColorHovered = $this.attr('data-spot-color-hovered');
}
if ($this.attr('data-spot-color') !== undefined && $this.attr('data-spot-color') !== false) {
spotColor = $this.attr('data-spot-color');
}
if ($this.attr('data-min-spot-color') !== undefined && $this.attr('data-min-spot-color') !== false) {
minSpotColor = $this.attr('data-min-spot-color');
}
if ($this.attr('data-max-spot-color') !== undefined && $this.attr('data-max-spot-color') !== false) {
maxSpotColor = $this.attr('data-max-spot-color');
}
if ($this.attr('data-bar-spacing') !== undefined && $this.attr('data-bar-spacing') !== false) {
barSpacing = $this.attr('data-bar-spacing');
}
if ($this.attr('data-bar-width') !== undefined && $this.attr('data-bar-width') !== false) {
barWidth = $this.attr('data-bar-width');
}
if ($this.attr('data-bar-color') !== undefined && $this.attr('data-bar-color') !== false) {
barColor = $this.attr('data-bar-color');
}
if ($this.attr('data-color-map') !== undefined && $this.attr('data-color-map') !== false) {
colorMap = $this.attr('data-color-map').split(/, /);
}
if ($this.attr('data-offset') !== undefined && $this.attr('data-offset') !== false) {
offset = $this.attr('data-offset');
}
if ($this.attr('data-slice-colors') !== undefined && $this.attr('data-slice-colors') !== false) {
sliceColors = $this.attr('data-slice-colors').split(/, /);
}
if ($this.attr('data-range-colors') !== undefined && $this.attr('data-range-colors') !== false) {
rangeColors = $this.attr('data-range-colors').split(/, /);
}
if ($this.attr('data-target-width') !== undefined && $this.attr('data-target-width') !== false) {
targetWidth = $this.attr('data-target-width');
}
if ($this.attr('data-pos-bar-color') !== undefined && $this.attr('data-pos-bar-color') !== false) {
posBarColor = $this.attr('data-pos-bar-color');
}
if ($this.attr('data-neg-bar-color') !== undefined && $this.attr('data-neg-bar-color') !== false) {
negBarColor = $this.attr('data-neg-bar-color');
}
if ($this.attr('data-performance-color') !== undefined && $this.attr('data-performance-color') !== false) {
performanceColor = $this.attr('data-performance-color');
}
if ($this.attr('data-fill-color') !== undefined && $this.attr('data-fill-color') !== false) {
fillColor = $this.attr('data-fill-color');
}
if ($this.attr('data-type') == 'bar') {
type = 'bar';
}
if ($this.attr('data-type') == 'pie') {
type = 'pie';
width = 'auto';
}
if ($this.attr('data-type') == 'discrete') {
type = 'discrete';
}
if ($this.attr('data-type') == 'tristate') {
type = 'tristate';
}
if ($this.attr('data-type') == 'bullet') {
type = 'bullet';
}
if ($this.attr('data-type') == 'box') {
type = 'box';
}
$this.sparkline(line, {
type : type,
width : width,
height : height,
lineColor : lineColor,
fillColor : fillColor,
lineWidth : lineWidth,
spotColor : spotColor,
minSpotColor : minSpotColor,
maxSpotColor : maxSpotColor,
highlightSpotColor : spotColorHovered,
highlightLineColor : verticalLineColor,
spotRadius : 6,
chartRangeMin : 0,
barSpacing : barSpacing,
barWidth : barWidth,
barColor : barColor,
offset : offset,
sliceColors : sliceColors,
colorMap : colorMap,
posBarColor : posBarColor,
negBarColor : negBarColor,
zeroBarColor : zeroBarColor,
rangeColors : rangeColors,
performanceColor : performanceColor,
targetWidth : targetWidth,
targetColor : targetColor
});
});
}
//Portfolio Filter
function isotopFilter() {
var $ = jQuery;
$('.portfolio, .filter-box').each(function () {
var filterBox = $(this),
filterElems = filterBox.find('.filter-elements'),
buttonBox = filterBox.find('.filter-buttons'),
selector = filterBox.find('.filter-buttons .active').attr('data-filter');
if (!filterBox.hasClass('accordions-filter')) {
filterElems.isotope({
filter: selector,
layoutMode: 'fitRows'
});
buttonBox.find('.dropdown-toggle').html(filterBox.find('.filter-buttons .active').text() + '')
}
buttonBox.find('a').on('click', function(e){
var selector = $(this).attr('data-filter');
e.preventDefault();
if (!$(this).hasClass('active')) {
buttonBox.find('a').removeClass('active');
$(this).addClass('active');
buttonBox.find('.dropdown-toggle').html($(this).text() + '')
if (filterBox.hasClass('accordions-filter')) {
filterElems.children().children().not(selector)
.animate({ height : 0 })
.addClass('e-hidden');
filterElems.find(selector)
.animate({ height : '100%' })
.removeClass('e-hidden');
} else {
filterElems.isotope({
filter: selector,
layoutMode: 'fitRows'
});
}
}
});
});
}
//Add your review
function addReview() {
var $ = jQuery;
$('a[href="#reviews"].add-review').click(function(){
$('.product-tab a[href="#reviews"]').trigger('click');
$('html, body').animate({
scrollTop: $("#reviews").offset().top
}, 1000);
});
}
// Zoomer
function zoom() {
var $ = jQuery;
if ($.fn.elevateZoom) {
var image = $('.general-img').find('img'),
zoomType,
zoomWidth = 470,
zoomHeight = 470,
zoomType = 'window';
if (($('body').width() + scrollWidth) < 992) {
zoomWidth = 0;
zoomHeight = 0;
zoomType = 'inner';
}
image.removeData('elevateZoom');
$('.zoomContainer').remove();
image.elevateZoom({
gallery : 'thumblist',
cursor : 'crosshair',
galleryActiveClass : 'active',
zoomWindowWidth : zoomWidth,
zoomWindowHeight : zoomHeight,
borderSize : 0,
borderColor : 'none',
lensFadeIn : true,
zoomWindowFadeIn : true,
zoomType : zoomType
});
}
}
//Blur
function blur() {
var $ = jQuery;
$('.full-width-box .fwb-blur').each(function () {
var blurBox = $(this),
img = new Image(),
amount = 2,
prependBox = '';
img.src = blurBox.attr('data-blur-image');
if (
blurBox.attr('data-blur-amount') !== undefined &&
blurBox.attr('data-blur-amount') !== false
)
amount = blurBox.attr('data-blur-amount');
img.onload = function() {
Pixastic.process(img, "blurfast", {
amount: amount
});
}
if (blurBox.hasClass('paralax')) {
prependBox = '';
}
blurBox
.prepend( prependBox )
.find('.blur-box')
.prepend( img )
setTimeout(function(){
$('body').addClass('blur-load');
}, 0 );
});
}
function blurPage() {
var $ = jQuery;
if ($('.blur-page').length) {
var blurBox = $('.blur-page');
blurBox.each(function () {
var $this = $(this),
img = new Image(),
amount = 2,
prependBox = '';
img.src = $this.attr('data-blur-image');
if (
$this.attr('data-blur-amount') !== undefined &&
$this.attr('data-blur-amount') !== false
)
amount = $this.attr('data-blur-amount');
img.onload = function() {
Pixastic.process(
img,
'blurfast',
{
amount: amount
},
function(){
$('.blur-page').addClass('blur-load')
}
);
}
$this.prepend( prependBox ).find('.blur-box').prepend( img );
});
}
}
//Paralax
function paralax() {
var $ = jQuery;
if(typeof($.fn.stellar) !== 'undefined') {
if(!navigator.userAgent.match(/iPad|iPhone|Android/i) && ($('body').width() + scrollWidth) >= 979) {
$('body').stellar({
horizontalScrolling: false,
verticalOffset: 0,
horizontalOffset: 0,
responsive: true,
scrollProperty: 'scroll',
parallaxElements: false,
});
}
}
}
//Video Background
function videoBg() {
var $ = jQuery;
if(typeof($.fn.tubular) !== 'undefined') {
var id,
options,
poster,
youtube = $('.fwb-youtube-video');
if (
youtube.attr('data-youtube-videoId') !== undefined &&
youtube.attr('data-youtube-videoId') !== false) {
id = youtube.attr('data-youtube-videoId');
}
if (
youtube.attr('data-youtube-poster') !== undefined &&
youtube.attr('data-youtube-poster') !== false) {
poster = youtube.attr('data-youtube-poster');
}
options = {
videoId: id,
start: 0,
wrapperZIndex: -1,
mute: true,
width: $('body').width()
}
if( navigator.userAgent.match(/iPad|iPhone|Android/i) ) {
youtube.css('background-image', "url('"+poster+"')");
} else {
youtube.tubular(options);
}
}
}
function loadingButton() {
var $ = jQuery;
loading = function(){
if ($('.ladda-button.progress-button').length) {
Ladda.bind('.ladda-button:not(.progress-button)', {
timeout: 2000
});
Ladda.bind('.ladda-button.progress-button', {
callback: function(instance) {
var interval,
progress;
progress = 0;
return interval = setInterval(function() {
progress = Math.min(progress + Math.random() * 0.1, 1);
instance.setProgress(progress);
if (progress === 1) {
instance.stop();
return clearInterval(interval);
}
}, 200);
}
});
}
}
if (/MSIE (\d+\.\d+);/.test(navigator.userAgent)){
var ieversion = new Number(RegExp.$1);
if (ieversion >= 9) {
loading();
}
} else {
loading();
}
}
function productLimited() {
var $ = jQuery;
if ($('.product .limit-offer').length){
var product = $('.product .limit-offer'),
endDateTime = '';
product.each(function () {
var $this = $(this);
if (
$this.attr('data-end') !== undefined &&
$this.attr('data-end') !== false) {
endDateTime = $this.attr('data-end');
} else {
endDateTime = '';
}
$this.county({
endDateTime: new Date(endDateTime),
animation: 'scroll',
reflection: false
});
});
}
}
//Google Map
function google_map() {
var $ = jQuery,
mapCanvas = $('.map-canvas');
mapCanvas.each(function () {
var $this = $(this),
zoom = 8,
lat = -34,
lng = 150,
scrollwheel = false,
draggable = true,
mapType = google.maps.MapTypeId.ROADMAP,
title = '',
contentString = '',
dataZoom = $this.attr('data-zoom'),
dataLat = $this.attr('data-lat'),
dataLng = $this.attr('data-lng'),
dataType = $this.attr('data-type'),
dataScrollwheel = $this.attr('data-scrollwheel'),
dataHue = $this.attr('data-hue'),
dataTitle = $this.attr('data-title'),
dataContent = $this.html();
//$this.html('');
if (dataZoom !== undefined && dataZoom !== false) {
zoom = parseFloat(dataZoom);
}
if (dataLat !== undefined && dataLat !== false) {
lat = parseFloat(dataLat);
}
if (dataLng !== undefined && dataLng !== false) {
lng = parseFloat(dataLng);
}
if (dataScrollwheel !== undefined && dataScrollwheel !== false) {
scrollwheel = dataScrollwheel;
}
if (dataType !== undefined && dataType !== false) {
if (dataType == 'satellite') {
mapType = google.maps.MapTypeId.SATELLITE;
} else if (dataType == 'hybrid') {
mapType = google.maps.MapTypeId.HYBRID;
} else if (dataType == 'terrain') {
mapType = google.maps.MapTypeId.TERRAIN;
}
}
if (dataTitle !== undefined && dataTitle !== false) {
title = dataTitle;
}
if( navigator.userAgent.match(/iPad|iPhone|Android/i) ) {
draggable = false;
}
var mapOptions = {
zoom : zoom,
scrollwheel : scrollwheel,
draggable : draggable,
center : new google.maps.LatLng(lat, lng),
mapTypeId : mapType
};
var map = new google.maps.Map($this[0], mapOptions);
var image = Drupal.settings.basePath + Drupal.settings.pathmodule + '/images/map-mapker.png';
if (dataContent !== undefined && dataContent !== false) {
contentString = '' +
'
' + title + '
' +
dataContent +
'';
}
var infowindow = new google.maps.InfoWindow({
content: contentString
});
var marker = new google.maps.Marker({
position : new google.maps.LatLng(lat, lng),
map : map,
draggable: true,
icon : image,
title : title
});
if (dataContent !== undefined && dataContent !== false) {
google.maps.event.addListener(marker, 'click', function() {
infowindow.open(map,marker);
});
}
if (dataHue !== undefined && dataHue !== false) {
var styles = [
{
stylers : [
{ hue : dataHue }
]
}
];
map.setOptions({styles: styles});
}
});
}
/*
function loadScript() {
var script = document.createElement('script');
script.type = 'text/javascript';
script.src = 'https://maps.googleapis.com/maps/api/js?v=3.exp&sensor=false&' +
'callback=initialize';
document.body.appendChild(script);
}
window.onload = function(){
loadScript();
}
*/
//Remove Video
if( navigator.userAgent.match(/iPad|iPhone|Android/i) ) {
jQuery('.fwb-video').find('video').remove();
}
//Word Rotate
function wordRotate() {
var $ = jQuery;
$('.word-rotate').each(function() {
var $this = $(this),
wordsBox = $this.find('.words-box'),
words = wordsBox.find('> span'),
firstWord = words.eq(0),
firstWordClone = firstWord.clone(),
wordHeight,
currentItem = 1,
currentTop = 0;
wordHeight = firstWord.height();
wordsBox.append(firstWordClone);
$this.height(wordHeight).addClass('loaded');
setInterval(function() {
currentTop = (currentItem * wordHeight);
wordsBox.animate({
top: -(currentTop) + 'px'
}, 300, 'easeOutQuad', function() {
currentItem++;
if(currentItem > words.length) {
wordsBox.css('top', 0);
currentItem = 1;
}
});
}, 2000);
});
}
//Modal Window
function centerModal() {
var $ = jQuery;
$(this).css('display', 'block');
var dialog = $(this).find('.modal-dialog'),
offset = ($(window).height() - dialog.height()) / 2;
if (offset < 10) {
offset = 10;
}
dialog.css('margin-top', offset);
}
//Social Feed
function locationSocialFeed() {
var $ = jQuery,
socialFeed = $('.social-feed');
if(typeof($.fn.isotope) !== 'undefined') {
socialFeed.isotope({
itemSelector: '.isotope-item',
}).addClass('loaded');
$('#load-more').click(function() {
var item1, item2, item3, items, tmp;
items = socialFeed.find('.item-clone');
item1 = $(items[Math.floor(Math.random() * items.length)]).clone();
item2 = $(items[Math.floor(Math.random() * items.length)]).clone();
item3 = $(items[Math.floor(Math.random() * items.length)]).clone();
tmp = $().add(item1).add(item2).add(item3);
var images = tmp.find('img');
images.imagesLoaded(function(){
return socialFeed.isotope('insert', tmp);
});
});
}
}
jQuery(document).ready(function(){
'use strict';
var $ = jQuery;
//Replace img > IE8
if (/MSIE (\d+\.\d+);/.test(navigator.userAgent)){
var ieversion = new Number(RegExp.$1);
if (ieversion < 9) {
$('img[src*="svg"]').attr('src', function() {
return $(this).attr('src').replace('.svg', '.png');
});
}
}
//IE
if (/MSIE (\d+\.\d+);/.test(navigator.userAgent)){
$('html').addClass('ie');
}
//Touch device
if( navigator.userAgent.match(/iPad|iPhone|Android/i) ) {
$('body').addClass('touch-device');
}
//Meta Head
if (document.width > 768) {
$('.viewport').remove();
}
//Bootstrap Elements
$('[data-toggle="tooltip"], .tooltip-link').tooltip();
$("a[data-toggle=popover]")
.popover()
.click(function(event) {
event.preventDefault();
});
$('.btn-loading').click(function () {
var btn = $(this);
btn.button('loading');
setTimeout(function () {
btn.button('reset')
}, 3000);
});
$('.disabled, fieldset[disabled] .selectBox').click(function () {
return false;
});
$('.modal-center').on('show.bs.modal', centerModal);
//Bootstrap Validator
if(typeof($.fn.bootstrapValidator) !== 'undefined') {
$('.form-validator').bootstrapValidator({
excluded: [':disabled', ':hidden', ':not(:visible)'],
feedbackIcons: {
valid: 'glyphicon glyphicon-ok',
invalid: 'glyphicon glyphicon-remove',
validating: 'glyphicon glyphicon-refresh'
},
message: 'This value is not valid',
trigger: null
});
}
//Bootstrap Datepicker
if(typeof($.fn.datepicker) !== 'undefined') {
$('.datepicker-box').datepicker({
todayHighlight : true,
beforeShowDay: function (date){
if (date.getMonth() == (new Date()).getMonth())
switch (date.getDate()){
case 4:
return {
tooltip: 'Example tooltip',
classes: 'active'
};
case 8:
return false;
case 12:
return "green";
}
}
});
}
//Revolution Slider
if ($('.tp-banner').length) {
var revolutionSlider = $('.tp-banner');
if (revolutionSlider.closest('.rs-slider').hasClass('full-width')) {
var body = $('body'),
width = body.width(),
topHeight = 0,
headerHeight = 104,
height;
if ($('#top-box').length) {
if (body.hasClass('hidden-top')) {
topHeight = $('#top-box').outerHeight() - 32;
}
}
if ((body.width() + scrollWidth) >= 1200) {
height = body.height() - (topHeight + headerHeight);
} else {
height = 800;
}
revolutionSlider.revolution({
delay : 6000,
startwidth : 1200,
startheight : height,
hideThumbs : 10,
navigationType : 'bullet',
navigationArrows : 'solo',
navigationHAlign : 'center',
navigationVAlign : 'top',
navigationHOffset : -545,
navigationVOffset : 30,
hideTimerBar : 'on'
}).parents('.slider').removeClass('load');
} else {
revolutionSlider.revolution({
delay : 6000,
startwidth : 1200,
startheight : 500,
hideThumbs : 10,
navigationType : 'none',
onHoverStop : 'off'
}).parents('.slider').removeClass('load');
}
}
//Royal Slider
if(typeof($.fn.royalSlider) !== 'undefined') {
$('.royal-slider').royalSlider({
arrowsNav : true,
loop : false,
keyboardNavEnabled : true,
controlsInside : false,
imageScaleMode : 'fill',
arrowsNavAutoHide : false,
autoScaleSlider : true,
autoScaleSliderWidth : 960,
autoScaleSliderHeight : 350,
controlNavigation : 'bullets',
thumbsFitInViewport : false,
navigateByClick : true,
startSlideId : 0,
autoPlay : false,
transitionType :'move',
globalCaption : false,
deeplinking : {
enabled : true,
change : true,
prefix : 'image-'
},
imgWidth : 1920,
imgHeight : 700
}).parents('.slider').removeClass('load');
}
//Layer Slider
if ($('.layerslider-box').length) {
$('.layerslider-box').layerSlider({
skinsPath : 'css/layerslider/skins/',
tnContainerWidth : '100%'
});
}
//Functions
fullWidthBox();
scrollMenu();
tabs();
accordions();
modernGallery();
animations();
chart();
// formStylization();
addReview();
zoom();
paralax();
videoBg();
loadingButton();
productLimited();
blurPage();
wordRotate();
locationSocialFeed();
//Carousel load
$(window).on({
load : function() {
blur();
progressiveSlider();
bannerSetCarousel();
thumblist();
carousel();
isotopFilter();
}
});
//Language-Currency
if( !navigator.userAgent.match(/iPad|iPhone|Android/i) ) {
$('.language, .currency, .sort-by, .show-by').hover(function(){
$(this).addClass('open');
}, function(){
$(this).removeClass('open');
});
}
//Header Phone & Search
$('.phone-header > a').click(function(event){
event.preventDefault();
$('.btn-group').removeClass('open');
$('.phone-active').fadeIn().addClass('open');
});
$('.search-header > a').click(function(event){
event.preventDefault();
$('.btn-group').removeClass('open');
$('.search-active').fadeIn().addClass('open');
});
$('.phone-active .close, .search-active .close').click(function(event){
event.preventDefault();
$(this).parent().fadeOut().removeClass('open');
});
$('body').on('click', function(event) {
var phone = '.phone-active',
search = '.search-active';
if ((!$(event.target).is(phone + ' *')) && (!$(event.target).is('.phone-header *'))) {
if ($(phone).hasClass('open')) {
$(phone).fadeOut().removeClass('open');
}
}
if ((!$(event.target).is(search + ' *')) && (!$(event.target).is('.search-header *'))) {
if ($(search).hasClass('open')) {
$(search).fadeOut().removeClass('open');
}
}
});
//Cart
$('.cart-header').hover(function(){
if (($('body').width() + scrollWidth) >= 979 ) {
$(this).addClass('open');
}
}, function(){
if (($('body').width() + scrollWidth) >= 979 ) {
$(this).removeClass('open');
}
});
//Product
if(!navigator.userAgent.match(/iPad|iPhone|Android/i)) {
$('.product, .employee')
.hover(function(event) {
event.preventDefault();
$(this).addClass('hover');
}, function(event) {
event.preventDefault();
$(this).removeClass('hover');
});
}
$('body').on('touchstart', function (event) {
event.stopPropagation();
if ($(event.target).parents('.product, .employee').length==0) {
$('.product, .employee').removeClass('hover');
}
});
$('.product, .employee').on('touchend', function(event){
if ($(this).hasClass('hover')) {
$(this).removeClass('hover');
} else {
$('.product, .employee').removeClass('hover');
$(this).addClass('hover');
}
});
//Menu > Sidebar
$('.menu .parent:not(".active") a').next('.sub').css('display', 'none');
$('.menu .parent a .open-sub').click(function(event){
event.preventDefault();
if ($(this).closest('.parent').hasClass('active')) {
$(this).parent().next('.sub').slideUp(600);
$(this).closest('.parent').removeClass('active');
} else {
$(this).parent().next('.sub').slideDown(600);
$(this).closest('.parent').addClass('active');
}
});
//Price Regulator
if(typeof($.fn.slider) !== 'undefined') {
$('#Slider2').slider({
from : 5000,
to : 150000,
limits : false,
heterogeneity : ['50/50000'],
step : 1000,
dimension : ' $'
});
}
//Contact Us
$('#submit').click(function(){
$.post('php/form.php', $('#contactform').serialize(), function(data) {
$('#success').html(data).animate({opacity: 1}, 500, function(){
if ($(data).is('.send-true')) {
$('#contactform').trigger( 'reset' );
}
});
});
return false;
});
//Coming Soon
$('#join-us').click(function(){
$.post('php/sent-email.php', $('#sent-email').serialize(), function(data) {
$('#sent-email .success').html(data).animate({opacity: 1}, 500, function(){
if ($(data).is('.send-true')) {
$('#sent-email').trigger( 'reset' );
}
});
});
return false;
});
//Regulator Up/Down
$('.number-up').click(function(){
var $value = ($(this).closest('.number').find('input[type="text"]').attr('value'));
$(this).closest('.number').find('input[type="text"]').attr('value', parseFloat($value)+1);
return false;
});
$('.number-down').click(function(){
var $value = ($(this).closest('.number').find('input[type="text"]').attr('value'));
if ($value > 1) {
$(this).closest('.number').find('input[type="text"]').attr('value', parseFloat($value)-1);
}
return false;
});
//Emergence Price
$('.emergence-price').click(function(){
$(this).animate({opacity: "0"}, 0);
$(this).prev('.price').fadeIn(1000);
return false;
});
//Gallery
if ($.fn.fancybox){
$('.gallery-images, .lightbox').fancybox({
nextEffect : 'fade',
prevEffect : 'fade',
openEffect : 'fade',
closeEffect : 'fade',
helpers : {
overlay : {
locked : false
}
},
tpl : {
closeBtn : '�',
next : '\n\
\n\
',
prev : '\n\
\n\
'
}
});
}
//Country
if ($.fn.county){
$('#count-down').county({
endDateTime: new Date($('#count-down').attr('data-time')),
reflection: false
}).addClass('count-loaded');
}
// Scroll to Top
$('#footer .up').click(function() {
$('html, body').animate({
scrollTop: $('body').offset().top
}, 500);
return false;
});
// Circular Bars - Knob
if(typeof($.fn.knob) != 'undefined') {
$('.knob').each(function () {
var $this = $(this),
knobVal = $this.attr('rel');
$this.knob({
'draw' : function () {
$(this.i).val(this.cv + '%')
}
});
$this.appear(function() {
$({
value: 0
}).animate({
value: knobVal
}, {
duration : 2000,
easing : 'swing',
step : function () {
$this.val(Math.ceil(this.value)).trigger('change');
}
});
}, {accX: 0, accY: -150});
});
}
//Facebook
if ($('.facebook-widget').length) {
(function(d, s, id) {
var js, fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id)) return;
js = d.createElement(s); js.id = id;
js.src = "http://connect.facebook.net/en_EN/all.js#xfbml=1";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));
}
//Twitter
if ($('.twitter-widget').length) {
!function(d,s,id){
var js,
fjs=d.getElementsByTagName(s)[0],
p=/^http:/.test(d.location)?'http':'https';
if(!d.getElementById(id)){
js=d.createElement(s);js.id=id;js.src=p+"://platform.twitter.com/widgets.js";
fjs.parentNode.insertBefore(js,fjs);
}
}(document,"script","twitter-wjs");
}
//One Page
$('a.scroll').on('click', function(e) {
var header = $('.header'),
headerHeight = header.height(),
target = $(this).attr('href'),
$this = $(this);
e.preventDefault();
if ($(target).length) {
if(($('body').width() + scrollWidth) > 991) {
$('html, body').animate({scrollTop: $(target).offset().top - (headerHeight)}, 600);
} else {
$('html, body').animate({scrollTop: $(target).offset().top}, 600);
}
//window.location.hash = target;
}
$('a.scroll').removeClass('active');
$this.addClass('active');
});
//JS loaded
$('body').addClass('loaded');
});
//Window Resize
(function() {
var $ = jQuery;
var delay = ( function() {
var timeout = { };
return function( callback, id, time ) {
if( id !== null ) {
time = ( time !== null ) ? time : 100;
clearTimeout( timeout[ id ] );
timeout[ id ] = setTimeout( callback, time );
}
};
})();
function resizeFunctions() {
if (($('body').width + scrollWidth) > 767) {
$('.viewport').remove();
} else {
$('head').append('');
}
//Functions
fullWidthBox();
tabs();
modernGallery();
animations();
chart();
isotopFilter();
zoom();
paralax();
$('.modal-center:visible').each(centerModal);
progressiveSlider();
bannerSetCarousel();
thumblist();
carousel();
}
if(navigator.userAgent.match(/iPad|iPhone|Android/i)) {
$(window).bind('orientationchange', function() {
setTimeout(function() {
resizeFunctions();
}, 150);
});
} else {
$(window).on('resize', function() {
delay( function() {
resizeFunctions();
}, 'resize');
});
}
}());
//Chart
function chart() {
var $ = jQuery;
$('.chart').each(function () {
var $this = $(this),
line = [],
type = 'line',
width = '100%',
height = '225',
lineColor = '#e1e1e1',
fillColor = 'rgba(0, 0, 0, .05)',
spotColor = '#a9a8a8',
minSpotColor = '#c6c6c6',
maxSpotColor = '#727070',
verticalLineColor = '#e1e1e1',
spotColorHovered = '#1e1e1e',
lineWidth = 2,
barSpacing = 8,
barWidth = 18,
barColor = 'rgba(0, 0, 0, .2)',
offset = 0,
sliceColors = [],
colorMap = [],
rangeColors = ['#d3dafe', '#a8b6ff', '#7f94ff'],
posBarColor = '#c6c6c6',
negBarColor = '#727070',
zeroBarColor = '#a9a8a8',
performanceColor = '#575656',
targetWidth = 5,
targetColor = '#1e1e1e';
if ($this.attr('data-line') !== undefined && $this.attr('data-line') !== false) {
line = $this.attr('data-line').split(/,/);
}
if ($this.attr('data-height') !== undefined && $this.attr('data-height') !== false) {
height = $this.attr('data-height');
}
if ($this.attr('data-line-width') !== undefined && $this.attr('data-line-width') !== false) {
lineWidth = $this.attr('data-line-width');
}
if ($this.attr('data-line-color') !== undefined && $this.attr('data-line-color') !== false) {
lineColor = $this.attr('data-line-color');
}
if ($this.attr('data-vertical-line-color') !== undefined && $this.attr('data-vertical-line-color') !== false) {
verticalLineColor = $this.attr('data-vertical-line-color');
}
if ($this.attr('data-spot-color-hovered') !== undefined && $this.attr('data-spot-color-hovered') !== false) {
spotColorHovered = $this.attr('data-spot-color-hovered');
}
if ($this.attr('data-spot-color') !== undefined && $this.attr('data-spot-color') !== false) {
spotColor = $this.attr('data-spot-color');
}
if ($this.attr('data-min-spot-color') !== undefined && $this.attr('data-min-spot-color') !== false) {
minSpotColor = $this.attr('data-min-spot-color');
}
if ($this.attr('data-max-spot-color') !== undefined && $this.attr('data-max-spot-color') !== false) {
maxSpotColor = $this.attr('data-max-spot-color');
}
if ($this.attr('data-bar-spacing') !== undefined && $this.attr('data-bar-spacing') !== false) {
barSpacing = $this.attr('data-bar-spacing');
}
if ($this.attr('data-bar-width') !== undefined && $this.attr('data-bar-width') !== false) {
barWidth = $this.attr('data-bar-width');
}
if ($this.attr('data-bar-color') !== undefined && $this.attr('data-bar-color') !== false) {
barColor = $this.attr('data-bar-color');
}
if ($this.attr('data-color-map') !== undefined && $this.attr('data-color-map') !== false) {
colorMap = $this.attr('data-color-map').split(/, /);
}
if ($this.attr('data-offset') !== undefined && $this.attr('data-offset') !== false) {
offset = $this.attr('data-offset');
}
if ($this.attr('data-slice-colors') !== undefined && $this.attr('data-slice-colors') !== false) {
sliceColors = $this.attr('data-slice-colors').split(/, /);
}
if ($this.attr('data-range-colors') !== undefined && $this.attr('data-range-colors') !== false) {
rangeColors = $this.attr('data-range-colors').split(/, /);
}
if ($this.attr('data-target-width') !== undefined && $this.attr('data-target-width') !== false) {
targetWidth = $this.attr('data-target-width');
}
if ($this.attr('data-pos-bar-color') !== undefined && $this.attr('data-pos-bar-color') !== false) {
posBarColor = $this.attr('data-pos-bar-color');
}
if ($this.attr('data-neg-bar-color') !== undefined && $this.attr('data-neg-bar-color') !== false) {
negBarColor = $this.attr('data-neg-bar-color');
}
if ($this.attr('data-performance-color') !== undefined && $this.attr('data-performance-color') !== false) {
performanceColor = $this.attr('data-performance-color');
}
if ($this.attr('data-fill-color') !== undefined && $this.attr('data-fill-color') !== false) {
fillColor = $this.attr('data-fill-color');
}
if ($this.attr('data-type') == 'bar') {
type = 'bar';
}
if ($this.attr('data-type') == 'pie') {
type = 'pie';
width = 'auto';
}
if ($this.attr('data-type') == 'discrete') {
type = 'discrete';
}
if ($this.attr('data-type') == 'tristate') {
type = 'tristate';
}
if ($this.attr('data-type') == 'bullet') {
type = 'bullet';
}
if ($this.attr('data-type') == 'box') {
type = 'box';
}
$this.sparkline(line, {
type : type,
width : width,
height : height,
lineColor : lineColor,
fillColor : fillColor,
lineWidth : lineWidth,
spotColor : spotColor,
minSpotColor : minSpotColor,
maxSpotColor : maxSpotColor,
highlightSpotColor : spotColorHovered,
highlightLineColor : verticalLineColor,
spotRadius : 6,
chartRangeMin : 0,
barSpacing : barSpacing,
barWidth : barWidth,
barColor : barColor,
offset : offset,
sliceColors : sliceColors,
colorMap : colorMap,
posBarColor : posBarColor,
negBarColor : negBarColor,
zeroBarColor : zeroBarColor,
rangeColors : rangeColors,
performanceColor : performanceColor,
targetWidth : targetWidth,
targetColor : targetColor
});
});
}
//Counting
function Counting()
{
function animateValue(taget, start, end, duration) {
// assumes integer values for start and end
var obj = document.getElementById(id);
var range = end - start;
// no timer shorter than 50ms (not really visible any way)
var minTimer = 50;
// calc step time to show all interediate values
var stepTime = Math.abs(Math.floor(duration / range));
// never go below minTimer
stepTime = Math.max(stepTime, minTimer);
// get current time and calculate desired end time
var startTime = new Date().getTime();
var endTime = startTime + duration;
var timer;
function run() {
var now = new Date().getTime();
var remaining = Math.max((endTime - now) / duration, 0);
var value = Math.round(end - (remaining * range));
obj.innerHTML = value;
if (value == end) {
clearInterval(timer);
}
}
var timer = setInterval(run, stepTime);
run();
}
$('.counter_number').each(function(){
var container = $(this);
var start = container.find('.couting').attr('data-start');
var end = container.find('.couting').attr('data-end');
var content = container.find('.couting').data('data-end');
var duration = container.find('.couting').attr('data-speed')
if(duration)
{
var speed = parseInt(duration / end);
var interval = setInterval(function(){
if(start - 1 < end)
{
container.find('.number').html(start);
}
else
{
container.find('.number').html(content);
clearInterval(interval);
}
start++;
},speed)
} else
{
container.find('.number').html(content);
}
});
}
}(jQuery));;