$(document).ready(function(){
}
/* light box
----------------------------------------------*/
var lightBox={
init:function(){
var self=this;
self.localvideo={
autoPlay:false,
preload:'metadata',
webm :true,
ogv:false
}
this.bindUIActions();
},generateVideo:function(src,poster){
var self=this;
//here we generate video markup for html5 local video
//We assumed that you have mp4 and webm or ogv format in samepath (video/01/01.mp4 & video/01/01.webm)
var basePath=src.substr(0, src.lastIndexOf('.mp4'));
var headOptions='';
if (self.localvideo.autoPlay){
headOptions+=' autoplay';
}
headOptions +='preload="'+self.localvideo.preload+'"';
var markup=''+'
'
},
gallery: {
enabled: true,
tPrev: 'Previous',
tNext: 'Next',
tCounter: '%curr% / %total%',
arrowMarkup: '',
},
callbacks:{
elementParse:function(item){
var popType=item.el.attr('data-type') || 'image',
source=item.el.attr('href');
if (popType=='localvideo'){
item.src=self.generateVideo(source,item.el.attr('data-poster')||'');
item.type='inline';
}else{
item.type=popType;
}
},
open:function(){
sideS.$exteras=$('.move-with-js').add('.mfp-wrap');
$('.popup-mejs').mediaelementplayer();
},
change: function() {
if (this.isOpen) {
this.wrap.addClass('mfp-open');
}
//console.log($('.popup-mejs'));
$('.popup-mejs').mediaelementplayer();
}
},
type: 'image' // this is a default type
});
itemsArray=[];
}
}
lightBox.init();
/* accordion
This has an option to open the desired tab by default
you can add a class of .active to the item you want to be oppened by default
----------------------------------------------*/
var acc,accordion={
settings : {
accUIelClass : ".accordion > .item > .head a",
openFirstOne : true //change to false if you want them all be closed by default
},
init : function(){
acc = this.settings;
this.bindUIActions();
//close all bodies except the stated one
$(".accordion > .item:not(.active) > .body").hide();
// if none of els are stated active open up the first one
if ( $(".accordion > .item.active").length == 0 && acc.openFirstOne )
$(".accordion > .item:first-child > .body").addClass('active').slideDown();
},
bindUIActions : function(){
var self = this, $body = $('body');
$body.on('click', acc.accUIelClass, function(event){
var $this = $(this);
$this.parents(".item").addClass("active").siblings().removeClass("active");
$(".accordion > .item:not(.active) > .body").slideUp();
$this.parent().next().slideDown();
event.preventDefault();
return false;
});
}
}
accordion.init();
/* Tabs
This has an option to open the desired tab by default
you can add a class of .active to li item and .tab-item to make it active
----------------------------------------------*/
var tabS,tabs={
settings : {
tabsBodiesExceptActive : $(".tabs > .tabs-body > .tab-item:not(.active)"),
tabsUIelClass : ".tabs > ul.tabs-head a"
},
init : function(){
tabS = this.settings;
this.bindUIActions();
//if we dont have an active one set the first one to be active
if ( $(".tabs > .tabs-head > li.active").length == 0)
$(".tabs > .tabs-body > .tab-item:first-child, .tabs > .tabs-head > li:first-child").addClass('active');
},
bindUIActions : function(){
var self = this,
$body = $('body');
$body.on('click', tabS.tabsUIelClass, function(event){
var $this = $(this).parent(),
index = $("ul.tabs-head li").index($this);
$this.addClass('active').siblings().removeClass('active');
$(".tabs > .tabs-body > .tab-item").eq(index).addClass('active').siblings().removeClass('active');
//$this.parent().addClass('active').siblings().removeClass("active");
event.preventDefault();
return false;
});
}
}
tabs.init();
/* Team carousel
Please refer to the documentation of MasterSlider
----------------------------------------------*/
var teamCarousel = {
init : function(){
var slider = new MasterSlider();
slider.setup('teamcarousel' , {
loop:true,
width:240,
height:240,
speed:20,
view:'fadeBasic',
preload:0,
space:0,
wheel:true
});
slider.control('arrows');
slider.control('slideinfo',{insertTo:'#teamcarousel-info'});
}
}
if ($('#teamcarousel').length>0){
teamCarousel.init();
}
var msSlider={
//This is the function that controlls all masterslider instances or atleast it tries to do!
init:function($target){
var self=this;
//Select the target which can be passed to the function or auto selected from DOM
var $elem=$target || $('.tj-ms-slider');
//Call the main function that apply master slider on selected elements
$elem.each(function(){
var $this=$(this);
//Some basic settings
var msOptions={
ewidth:$this.attr('data-width')|| $this.width(),
eheight:$this.attr('data-height') || $this.height(),
layout:$this.attr('data-layout') || 'boxed',
view:$this.attr('data-view') || 'basic',
dir:$this.attr('data-dir')||'h',
showCounter:$this.attr('data-counter') || false,
isGallery:$this.attr('data-gallery') || false,
autoHeight:$this.attr('data-autoheight') || false,
hasPlay:$this.attr('data-playbtn') || false,
galleryWrapper:$this.parents('.tj-ms-gallery'),
mouse:($this.attr('data-mouse')||true)==true,
fillMode:$this.attr('data-fillmode')||'fill',
initialPlay:false
}
self.runSlider($this,msOptions);
});
},
runSlider:function($elem,options){
var self=this;
var slider = new MasterSlider(),
elemID=$elem.attr('id')||'';
slider.setup(elemID , {
width:options.ewidth,
height:options.eheight,
layout:options.layout,
view:options.view,
dir:options.dir,
autoHeight:options.autoHeight,
space:0,
preload:1,
centerControls:false,
mouse:options.mouse,
fillMode:options.fillMode,
overPause:false
});
slider.control('arrows',{autohide:false});
if (options.hasPlay){
slider.control('timebar' , {autohide:false,color:"#dc971f"});
}
if (options.isGallery){
self.makeGallery($elem,slider);
}
slider.api.addEventListener(MSSliderEvent.INIT , function(){
var $controlsWrapper=$elem.find('.ms-container'),
$controlUI=$('').appendTo($controlsWrapper);
//Play pause button
if (options.hasPlay){
var playBtn=$('').addClass('tj-playbtn').appendTo($controlUI);
self.addPlay(slider,playBtn,options);
}
//Next & Prev buttons
$controlUI.append($controlsWrapper.find('.ms-nav-prev'));
//First one is prev and last next add anything in betwen(eg.counter)
if (options.showCounter){
var counterMarkup='