Last active
August 29, 2015 14:13
-
-
Save awhedbee22/b1824b84e4f69a827dda to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Reveal Contact Form | |
$('.reveal-contact a').attr({ | |
'data-reveal-id': 'contactModal', | |
'data-reveal': '' | |
}); | |
// Add Wave to all buttons | |
$(".button").addClass( "waves-effect waves-button waves-float" ); | |
// Waves Click | |
Waves.displayEffect(); | |
// Animate CSS | |
$('#article-header').addClass('animated fadeInDown'); | |
$('.single-product #main').addClass('animated fadeInDown'); | |
$('#article-header').one('webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend', function() { | |
$('ul.products').addClass('animated fadeIn'); | |
$('.dropdown.fab').addClass('fadeIn'); | |
}); | |
window.onload = function(e) { | |
// Mimic height/height of divs on load | |
var tallness = $("#logo").height(); | |
$("#article-header").height(tallness); | |
var matchHeight = $(".images").height(); | |
$(".summary").height(matchHeight); | |
// Width of header | |
$("#main").width(); | |
$("#article-header").width ( $("#main").width() ); | |
// Equal height products | |
var tallest = 0; | |
$('.product h3').each(function() { | |
tallest = $(this).height() > tallest ? $(this).height() : tallest; | |
}).height(tallest); | |
// Add margin | |
var articleHeight = $("#article-header").height(); | |
$('.products').css({'margin-top': articleHeight+35}); | |
// Fixed header on reload | |
var titleHeight = $('#article-header h1').outerHeight(); | |
var fixedTop = (tallness - titleHeight); | |
if ($(this).scrollTop() >= fixedTop){ | |
$('#article-header').addClass('fixedHeader'); | |
$('#article-header.fixedHeader').css("top", -fixedTop); | |
} | |
if ($(this).scrollTop() < fixedTop){ | |
$('#article-header').removeClass('fixedHeader'); | |
$('#article-header').css('top', '0'); | |
} | |
}; | |
window.onresize = function(e) { | |
// Mimic height of divs when resized | |
var tallness = $("#logo").height(); | |
$("#article-header").height(tallness); | |
var matchHeight = $(".images").height(); | |
$(".summary").height(matchHeight); | |
var articleHeight = $("#article-header").height(); | |
// Add margin | |
$('.products').css({'margin-top': articleHeight+35}); | |
// Set width to remainder of screen | |
$("#main").width(); | |
$("#article-header").width ( $("#main").width() ); | |
}; | |
$(window).scroll(function(fixedHeader){ | |
// Fixed header | |
var headerHeight = $('#article-header').height(); | |
var titleHeight = $('#article-header h1').outerHeight(); | |
var fixedTop = (headerHeight - titleHeight); | |
if ($(this).scrollTop() >= fixedTop){ | |
$('#article-header').addClass('fixedHeader'); | |
$('#article-header.fixedHeader').css("top", -fixedTop); | |
} | |
if ($(this).scrollTop() < fixedTop){ | |
$('#article-header').removeClass('fixedHeader'); | |
$('#article-header').css('top', '0'); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment