/***************************************************************************************************************
|||||||||||||||||||||||||||| custom script for medi plus ||||||||||||||||||||||||||||||||||||
****************************************************************************************************************
|||||||||||||||||||||||||||| table of content ||||||||||||||||||||||||||||||||||||
****************************************************************************************************************
****************************************************************************************************************
1 revolutionslideractiver
2 gallerymasonarylayout
3 accrodion
4 teamcarosule
5 testicarosule
6 counternumberchanger
7 stickyheader
8 contactformvalidation
9 selectinput
10 datepicker
11 gmap
12 mobilemenu
****************************************************************************************************************
|||||||||||||||||||||||||||| end table of content ||||||||||||||||||||||||||||||||||||
****************************************************************************************************************/
"use strict";
// 1 revolutionslideractiver
function revolutionslideractiver () {
if ($('.rev_slider_wrapper #slider1').length) {
$("#slider1").revolution({
slidertype:"standard",
sliderlayout:"auto",
delay:5000,
navigation: {
arrows:{enable:true}
},
gridwidth:1170,
gridheight:770
});
};
}
// 2 gallerymasonarylayout
function gallerymasonarylayout () {
if ($('.img-masonary').length) {
$('.img-masonary').isotope({
layoutmode:'masonry'
});
}
}
// 3 accrodion
function accrodion () {
if ($('.accrodion-grp').length) {
$('.accrodion-grp').each(function () {
var accrodionname = $(this).data('grp-name');
var self = $(this);
self.addclass(accrodionname);
self.find('.accrodion .accrodion-content').hide();
self.find('.accrodion.active').find('.accrodion-content').show();
self.find('.accrodion').each(function() {
$(this).find('.accrodion-title').on('click', function () {
if ($(this).parent().hasclass('active') === false ) {
$('.accrodion-grp.'+accrodionname).find('.accrodion').removeclass('active');
$('.accrodion-grp.'+accrodionname).find('.accrodion').find('.accrodion-content').slideup();
$(this).parent().addclass('active');
$(this).parent().find('.accrodion-content').slidedown();
};
});
});
});
};
}
// 4 teamcarosule
function teamcarosule () {
if ($('.team-carousel').length) {
$('.team-carousel').owlcarousel({
loop: true,
margin: 30,
nav: true,
dots: false,
navtext: [
'',
''
],
autoplay: true,
autoplaytimeout: 3000,
autoplayhoverpause: true,
responsive: {
0:{
items:1
},
480:{
items:1
},
600:{
items:2
},
1000:{
items:3
},
1200:{
items:4
}
}
});
}
}
// 5 testicarosule
function testicarosule () {
if ($('.testimonaials-carousel').length) {
$('.testimonaials-carousel').owlcarousel({
loop: true,
margin: 50,
nav: false,
dots: true,
autoplay: true,
autoplaytimeout: 3000,
autoplayhoverpause: true,
responsive: {
0:{
items:1
},
480:{
items:1
},
600:{
items:1
},
1000:{
items:2
},
1200:{
items:3
}
}
});
}
}
// 5 testicarosule
function testicarosule1 () {
if ($('.testimonaials-carousel1').length) {
$('.testimonaials-carousel1').owlcarousel({
loop: true,
margin: 50,
nav: false,
dots: true,
autoplay: true,
autoplaytimeout: 3000,
autoplayhoverpause: true,
responsive: {
0:{
items:1
},
480:{
items:1
},
600:{
items:1
},
1000:{
items:1
},
1200:{
items:1
}
}
});
}
}
// 6 counternumberchanger
function counternumberchanger () {
var timer = $('.timer');
if(timer.length) {
timer.appear(function () {
timer.countto();
})
}
}
// 7 stickyheader
function stickyheader () {
if ($('.stricky').length) {
var strickyscrollpos = 100;
if($(window).scrolltop() > strickyscrollpos) {
$('.stricky').removeclass('fadein animated');
$('.stricky').addclass('stricky-fixed fadeindown animated');
}
else if($(this).scrolltop() <= strickyscrollpos) {
$('.stricky').removeclass('stricky-fixed fadeindown animated');
$('.stricky').addclass('slidein animated');
}
};
}
// 8 contactformvalidation
function contactformvalidation () {
if($('.contact-form').length){
$('.contact-form').each(function () {
var cfname = $(this).attr('id');
$('#'+cfname).validate({ // initialize the plugin
rules: {
name: {
required: true
},
email: {
required: true,
email: true
},
message: {
required: true
},
date: {
required: true
},
category: {
required: true
},
phone: {
required: true
},
gender: {
required: true
},
dateofbirth: {
required: true
},
subject: {
required: true
}
},
submithandler: function (form) {
// sending value with ajax request
$.post($(form).attr('action'), $(form).serialize(), function (response) {
$(form).parent('div').append(response);
$(form).find('input[type="text"]').val('');
$(form).find('input[type="email"]').val('');
$(form).find('textarea').val('');
});
return false;
}
});
});
}
}
// 9 selectinput
function selectinput () {
if ($('.select-input').length) {
$('.select-input').selectmenu();
};
}
// 10 datepicker
function datepicker () {
if ($('.date-picker').length) {
$('.date-picker').datepicker();
};
}
// 11 gmap
function gmap () {
if ($('.google-map').length) {
$('.google-map').each(function () {
// getting options from html
var mapname = $(this).attr('id');
var maplat = $(this).data('map-lat');
var maplng = $(this).data('map-lng');
var iconpath = $(this).data('icon-path');
var mapzoom = $(this).data('map-zoom');
var maptitle = $(this).data('map-title');
// if zoom not defined the zoom value will be 15;
if (!mapzoom) {
var mapzoom = 15;
};
// init map
var map;
map = new gmaps({
div: '#'+mapname,
scrollwheel: false,
lat: maplat,
lng: maplng,
zoom: mapzoom
});
// if icon path setted then show marker
if(iconpath) {
map.addmarker({
icon: iconpath,
lat: maplat,
lng: maplng,
title: maptitle
});
}
});
};
}
// 12 mobilemenu
function mobilemenu () {
if ($('.navigation .nav-footer button').length) {
$('.navigation .nav-footer button').on('click', function () {
$('.navigation .nav-header').slidetoggle();
$('.navigation .nav-header').find('.dropdown').children('a').append(function () {
return '';
});
$('.navigation .nav-header .dropdown a button').on('click', function () {
$(this).parent().parent().children('ul.submenu').slidetoggle();
return false;
});
});
};
}
// dom ready function
jquery(document).on('ready', function () {
(function ($) {
// add your functions
revolutionslideractiver();
accrodion();
gallerymasonarylayout();
teamcarosule();
counternumberchanger();
testicarosule();
testicarosule1();
contactformvalidation();
selectinput();
datepicker();
gmap();
mobilemenu();
})(jquery);
});
// window on load functino
jquery(window).on('load', function () {
(function ($) {
// add your functions
})(jquery);
});
// window on scroll functino
jquery(window).on('scroll', function () {
(function ($) {
// add your functions
stickyheader();
})(jquery);
});