File: D:/HostingSpaces/SBogers10/debierbaron.komma.pro/wwwroot/js/main.js
/**
* Created by Pascal on 30/09/15.
*/
$img = $('.header-image img');
$imgC = $('.image-container');
$wl = $('#welcomeLink');
var imageWidth = $img.width(); // Current image width
var imageHeight = $img.height(); // Current image height
var imageRatio = imageHeight / imageWidth; // Used for aspect ratio
$(function () {
$img.one('load', function() {
resizer();
}).each(function() {
if(this.complete) $(this).load();
});
$(window).resize(function () {
resizer();
});
//$wl.on('click', function(event){
// event.preventDefault();
//
// $('html, body').animate({
// scrollTop: $( $.attr(this, 'href') ).offset().top
// }, 900);
//});
});
function resizer() {
var windowWidth = $(window).width(); // Max width for the image
var windowHeight = ($(window).height()-60); // Max height for the image
var windowRatio = windowHeight / windowWidth; // Used for aspect ratio
// Check if the current width is larger than the max
if (imageRatio <= windowRatio) {
var width = windowHeight / imageRatio;
$img.css({
'height': windowHeight,
'width': width,
'margin-left' : width / -2,
'margin-top' : 0,
'left': '50%',
'top': 0
});
} else {
var height = windowWidth * imageRatio;
$img.css({
'width': windowWidth,
'height': height,
'margin-top': height / -2,
'margin-left': 0,
'top': '50%',
'left': 0
});
}
$imgC.width(windowWidth).height(windowHeight);
}
$("#is_gift").click(function() {
if($(this).is(":checked")) {
$(".giftName").show(200);
} else {
$(".giftName").hide(200);
}
});