File: D:/HostingSpaces/SBogers36/mecurity-ramkraakbeveiliging.nl/wwwroot/js/main.js
/**
* Created by Komma Mediadesign.
* User: mike
* Date: 3/12/13
*/
var activeLabel = null;
$(document).ready(function()
{
/*
* Animate Objects when hovered
*/
var obj = $('.simpleHover');
var speed = 200;
$(obj).hover(function(){
$('.hover',this).stop().animate({opacity:1},speed);
},
function(){
$('.hover',this).stop().animate({opacity:0},speed);
});
/*
* Make every productBlock completely clickable.
*/
var pBlock = $('.pBlock');
$(pBlock).click(function(){
window.location.href = $('.pBlockLink',this).attr('href');
});
/*
* Animate projectBlock when hovered
*/
$(pBlock).hover(function(){
$('.pBlockOverlay',this).stop().animate({bottom:'-10px'},speed);
$('.pBlockArrowActive',this).stop().animate({rotate: '0', opacity: 1 }, speed);
$('.pBlockArrow',this).stop().animate({rotate: '-90deg' }, speed);
},
function(){
$('.pBlockOverlay',this).stop().animate({bottom:0},speed);
$('.pBlockArrowActive',this).stop().animate({rotate: '90deg', opacity: 0 }, speed);
$('.pBlockArrow',this).stop().animate({rotate: '0deg' }, speed);
});
/*
* Initialize Gallery
*/
var gallery = new SimpleGallery('#productSlider','#productSliderNav','#counter');
gallery.init();
/*
* Animate SubMenu when hovered
*/
obj = $('.simpleHover','.submenu');
$(obj).hover(function(){
$('.hover',this).stop().animate({opacity:1},speed);
if(!$(this).parent().hasClass('active')) $('.arrow',this).stop().animate({rotate: '90deg' }, speed);
},
function(){
$('.hover',this).stop().animate({opacity:0},speed);
if(!$(this).parent().hasClass('active')) $('.arrow',this).stop().animate({rotate: '0' }, speed);
});
/*
* Show Details
*/
$('.hasDetail').hover(function()
{
var detail = $('.detail', this);
$(detail).css({ display: 'block'});
$(detail).stop().animate({ opacity: 1, bottom: '-46px'},200);
var w = $('.label',detail).width() + parseInt($(detail).css('paddingLeft')) + parseInt($(detail).css('paddingRight')) ;
var ml = Math.round( w / -2 );
$(detail).css({ marginLeft: ml+'px' });
},
function(){
$('.detail',this).stop().animate({ opacity: 0, bottom: '-35px'},100,function(){ $(this).css({ display: 'none'}); });
});
/*
* Contact formulier
*/
var textField = $('.textField');
var textArea = $('.textArea');
$(textField).focus(function(){
var target = $(this).siblings('.textLabel');
var w = $(target).width() + parseInt($(target).css('paddingLeft')) + parseInt($(target).css('paddingRight'));
var l = Math.floor(w*-1);
$(target).stop().animate({ left: l+'px' },200);
});
$(textField).blur(function(){
console.log($(this).val());
if($(this).val() == '')
{
var target = $(this).siblings('.textLabel');
$(target).stop().animate({ left: '1px' },200);
}
});
$(textArea).focus(function(){
var target = $(this).siblings('.textLabel');
var w = $(target).width() + parseInt($(target).css('paddingLeft')) + parseInt($(target).css('paddingRight'));
var l = Math.floor(w*-1);
$(target).stop().animate({ left: l+'px' },200);
});
$(textArea).blur(function(){
if($(this).val() == '')
{
var target = $(this).siblings('.textLabel');
$(target).stop().animate({ left: '1px' },200);
}
});
$(textField).each(function(){
if($(this).val() != '')
{
var t = this;
setTimeout(function(){
var target = $(t).siblings('.textLabel');
var w = $(target).width() + parseInt($(target).css('paddingLeft')) + parseInt($(target).css('paddingRight'));
var l = Math.floor(w*-1);
$(target).css({ left: l+'px' });
},100);
}
});
$(textArea).each(function(){
if($(this).val() != '')
{
var t = this;
setTimeout(function(){
var target = $(t).siblings('.textLabel');
var w = $(target).width() + parseInt($(target).css('paddingLeft')) + parseInt($(target).css('paddingRight'));
var l = Math.floor(w*-1);
$(target).css({ left: l+'px' });
},100);
}
});
$('#submitForm').click(function() {
$('#contactForm').submit();
});
/*
$('.textLabel').each(function(index)
{
$(this).click(function(e){
if(activeLabel != null) $('.textLabel').eq(activeLabel).stop().animate({ left: 0 },200);
activeLabel = index;
var w = $(this).width() + parseInt($(this).css('paddingLeft')) + parseInt($(this).css('paddingRight'));
var l = w*-1;
$(this).stop().animate({ left: l+'px' },200);
});
});*/
$('a','#main_footer').hover(
function() {
if(!$(this).hasClass('komma'))
{
$(this).stop().animate({ color: "#ffffff" },300);
}
else
{
$(this).stop().animate({ opacity: 1 },300);
}
},
function()
{
if(!$(this).parent().hasClass('active'))
{
if( !$(this).hasClass('komma'))
{
$(this).stop().animate({ color: "#B9BEC3" },300);
}
else
{
$(this).stop().animate({ opacity: 0.4 },300);
}
}
}
);
$('#main_header a').hover(
function() {
$(this).stop().animate({ color: "#1B62C9" },300);
},
function()
{
if(!$(this).parent().hasClass('active'))
{
$(this).stop().animate({ color: "#777777" },300);
}
}
);
var callToAction = '.ctaBlock';
$(callToAction).click(function(e){
if(typeof e.target.href == 'undefined' || !e.target.href )
{
window.location.href = $('a.arrow',this).attr('href');
}
});
$(callToAction).hover(function(){
$('.hover',this).stop().animate({ opacity: 1 },300);
},function(){
$('.hover',this).stop().animate({ opacity: 0 },300);
});
$('.footerIcon').click(function()
{
$("html, body").animate({ scrollTop: "0" },500);
});
/* SUBMENULIST */
speed = 100;
$('.subMenuList ul li').click(function()
{
var btn = $('a',this);
$('#jsLoad').load('/mvc/controllers/c_saveViewport.php?offsetTop='+$(document).scrollTop(), function(){
window.location.href = $(btn).attr('href');
});
});
$('.subMenuList .title').hover(
function()
{
if ( ! $(this).parent().hasClass('active'))
$(this).stop().animate({ backgroundColor: "#124789" },speed);
},
function(){
if ( ! $(this).parent().hasClass('active'))
$(this).stop().animate({ backgroundColor: "#1B62C9" },speed);
}
);
$('.subMenuList ul li').hover(
function()
{
if ( ! $(this).hasClass('active'))
$(this).stop().animate({ backgroundColor: "#E1E1E1" },speed);
},
function()
{
if($(this).hasClass('alt'))
{
$(this).stop().animate({ backgroundColor: "#FAFAFA" },speed);
}
else
{
$(this).stop().animate({ backgroundColor: "#EFEFEF" },speed);
}
}
);
});