anna-dan-wedding-site/bigday/static/js/scripts.js

49 lines
1.1 KiB
JavaScript
Raw Normal View History

2019-08-01 21:15:20 +00:00
function scroll_to(clicked_link, nav_height) {
var element_class = clicked_link.attr('href').replace('#', '.');
var scroll_to = 0;
2019-08-02 15:59:00 +00:00
if(element_class != '.home') {
2019-08-01 21:15:20 +00:00
element_class += '-container';
scroll_to = $(element_class).offset().top - nav_height;
}
if($(window).scrollTop() != scroll_to) {
$('html, body').stop().animate({scrollTop: scroll_to}, 1000);
}
}
jQuery(document).ready(function() {
/*
Navigation
*/
$('a.scroll-link').on('click', function(e) {
e.preventDefault();
scroll_to($(this), $('nav').outerHeight());
});
// toggle "navbar-no-bg" class
2019-08-02 15:59:00 +00:00
$('.home .text').waypoint(function() {
2019-08-01 21:15:20 +00:00
$('nav').toggleClass('navbar-no-bg');
});
/*
2019-08-02 15:59:00 +00:00
Background
2019-08-01 21:15:20 +00:00
*/
2019-08-06 23:51:28 +00:00
$('.home').backstretch("/static/img/splash.jpg");
2019-08-01 21:15:20 +00:00
$('#top-navbar-1').on('shown.bs.collapse', function(){
2019-08-02 15:59:00 +00:00
$('.home').backstretch("resize");
2019-08-01 21:15:20 +00:00
});
$('#top-navbar-1').on('hidden.bs.collapse', function(){
2019-08-02 15:59:00 +00:00
$('.home').backstretch("resize");
2019-08-01 21:15:20 +00:00
});
$('a[data-toggle="tab"]').on('shown.bs.tab', function(){
$('.testimonials-container').backstretch("resize");
});
/*
Wow
*/
new WOW().init();
2019-08-06 23:51:28 +00:00
});