File: /home/dermova/public_html/me/wp-content/themes/dermoviva-en/js/main.js
// JavaScript Document
galleryheight = $('.contentcol01 img').height();
$('.galleryhold').css({'height':galleryheight});
$('.contentcol01').css({'min-height':galleryheight});
$(document).scroll(function() {
var y = $(this).scrollTop();
if (y > 140) {
$('#menutotop').fadeIn();
} else {
$('#menutotop').fadeOut();
}
});
$(window).scroll(function() {
if($(window).scrollTop() + $(window).height() == $(document).height()) {
$("#pgscroller").hide();
} else {
$("#pgscroller").show();
}
});
$('#pgscroller').click(function() {
var vheight = $(window).height();
$('html, body').animate({
scrollTop: (Math.floor($(window).scrollTop() / vheight)+1) * vheight
}, 500);
});
$(document).resize(function() {
navposition();
});
$(window).resize(function() {
navposition();
});
$(document).ready(function(){
navposition();
$('a.youtube').each(function() {
vidid = getYoutubeID( this.href );
vidlnk = this.href;
this.id = vidid;
var thumb_url = "http://i.ytimg.com/vi/"+vidid+"/mqdefault.jpg";
$('<img src="'+thumb_url+'" />').appendTo($('#'+vidid));
this.href = vidlnk.replace("youtube.com/watch?v=", "youtube.com/embed/")+'?autoplay=1';
});
$(".youtube").fancybox({
maxWidth : 800,
maxHeight : 600,
fitToView : false,
width : '70%',
height : '70%',
autoSize : false,
closeClick : false,
openEffect : 'none',
closeEffect : 'none',
padding : 10
});
$('.slider-main').slick({
dots: false,
infinite: true,
arrows: false,
speed: 800,
fade: true,
slidesToShow: 1,
slidesToScroll: 1,
autoplay: true,
/* adaptiveWidth: true, */
});
$('.productsholder').slick({
centerMode: true,
dots: false,
infinite: true,
arrows: false,
speed: 800,
fade: false,
slidesToShow: 3,
slidesToScroll: 1,
autoplay: true,
adaptiveWidth: true,
responsive: [
{
breakpoint: 1024,
settings: {
slidesToShow: 3,
centerMode: false
}
},
{
breakpoint: 650,
settings: {
slidesToShow: 2,
centerMode: false
}
},
{
breakpoint: 480,
settings: {
slidesToShow: 1,
centerMode: false
}
}
]
});
$('.ourStorySlider').slick({
slidesToShow: 1,
slidesToScroll: 1,
autoplay: true,
autoplaySpeed: 4000,
dots: false,
adaptiveHeight: false,
nextArrow: '<span class="slider-arrows slider-arrow-right">right</span>',
prevArrow: '<span class="slider-arrows slider-arrow-left">left</span>',
});
$('.slider-arrow-left').click(function() {
$('.slider-main').slickPrev();
});
$('.slider-arrow-right').click(function() {
$('.slider-main').slickNext();
});
$('.slider-arrow-left').click(function() {
$('.productsholder').slickPrev();
});
$('.slider-arrow-right').click(function() {
$('.productsholder').slickNext();
});
$('.wrapperbg').stellar({
scrollProperty: 'scroll'
});
});
$(function(){
$('#menu').slicknav({
label: 'MENU',
duration: 700,
});
if(dropitstat == 'disable'){
$('#submenubar').animate({'opacity':'1'}, 0);
} else {
$('#menu').dropit({
action: 'mouseenter',
beforeShow: function(){$('#submenubar').animate({'opacity':'1'}, 0);},
beforeHide: function(){$('#submenubar').animate({'opacity':'0'}, 100);}
});
}
$('#searchmenu').dropit({action: 'mouseenter'});
});
$(function() {
$('a[href*=#]:not([href=#])').click(function() {
if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'') && location.hostname == this.hostname) {
var target = $(this.hash);
target = target.length ? target : $('[name=' + this.hash.slice(1) +']');
if (target.length) {
$('html,body').animate({
scrollTop: target.offset().top
}, 800);
return false;
}
}
});
});
function navposition() {
pgwidth = $(window).width();
pgheight = $(window).height()-200;
$('#content').css({
'min-height':pgheight
});
galleryheight = $('.contentcol01 img').height();
$('.galleryhold').css({'height':galleryheight});
$('.contentcol01').css({'min-height':galleryheight});
solutionswidth = $('.solutions').width();
$('.solutions').css({'height':solutionswidth});
$('.solprod').css({'top':solutionswidth});
$('.solutionsholder').hover(function(){
$(this).find('.solmain').stop().animate({'top':-1*solutionswidth}, 300);
$(this).find('.solprod').stop().animate({'top':0}, 300);
}, function(){
$(this).find('.solmain').stop().animate({'top':0}, 300);
$(this).find('.solprod').stop().animate({'top':solutionswidth}, 300);
});
/*galleryheight = $('.contentcol01 img').height();
gallerytxtheight = $('.gallerytxt').height()+33;
$('.galleryhold').css({'height':galleryheight});
$('.gallerytxt').css({'top':galleryheight});
$('.contentcol01 a').hover(function(){
$(this).find('.galleryimg').stop().animate({'top':-1*gallerytxtheight}, 300);
$(this).find('.gallerytxt').stop().animate({'top':galleryheight-gallerytxtheight}, 300);
}, function(){
$(this).find('.galleryimg').stop().animate({'top':0}, 300);
$(this).find('.gallerytxt').stop().animate({'top':galleryheight}, 300);
});*/
};
function getYoutubeID(url) {
var id = url.match("[\\?&]v=([^&#]*)");
id = id[1];
return id;
};