Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save flayder/14b4077b41d2de2ab7ae2a92847bd22c to your computer and use it in GitHub Desktop.
Save flayder/14b4077b41d2de2ab7ae2a92847bd22c to your computer and use it in GitHub Desktop.
$(document).ready(function(){
var frame_w, frame_h, centrer1_w, centrer1_h, centrer1_t, centrer1_l, pjax, data, html_loaded, bg_video, mouse_pos, infra_xml, popup_gallery, load_page_js, preloader, param_search_url, menu_frame, menu_btn, menu_content_frame, banks_json;
var ratio = 0.5625;
function content_move() {
frame_w = $(window).width();
frame_h = $(window).height();
frame_d = frame_h / frame_w;
if (frame_d > ratio) {
centrer1_w = frame_h / ratio;
centrer1_h = frame_h;
centrer1_t = 0;
centrer1_l = 0.5 * (frame_w - centrer1_w);
} else {
centrer1_w = frame_w;
centrer1_h = frame_w * ratio;
centrer1_t = 0.5 * (frame_h - centrer1_h);
centrer1_l = 0;
}
}
content_move();
function element_check_size(targ) {
targ.css({'width': centrer1_w, 'height': centrer1_h, 'top': centrer1_t, 'left': centrer1_l});
}
$(window).on('resize', function() {
content_move();
});
//animations on scroll
new WOW().init();
$('.header__nav-btn').click(function(e){
e.preventDefault();
var text = $(this).find('.btn-text').html();
$(this).find('.btn-text').html(text == 'меню' ? 'закрыть' : 'меню');
$(this).toggleClass('active').siblings('.header__nav-menu').toggleClass('active');
})
expand();
$('.side-panel__open').click(function(e){
e.preventDefault();
$(this).removeClass('active').siblings().addClass('active');
$('.side-panel').addClass('active');
});
$('.side-panel__close').click(function(e){
e.preventDefault();
$(this).removeClass('active').siblings().addClass('active');
$('.side-panel').removeClass('active');
});
if($('#bg_stage').length > 0) {
element_check_size($('#bg_stage'));
$(window).on('resize', function() {
element_check_size($('#bg_stage'));
});
}
});
function expand() {
val = parseInt($('.house-readiness__percent .value').text(),10);
perc = val +'%'
$( ".house-readiness__ready" ).animate({
height: perc,
}, 3000);
$('.house-readiness__percent .value').each(function () {
$(this).prop('Counter',0).animate({
Counter: $(this).text()
}, {
duration: 3000,
easing: 'swing',
step: function (now) {
$(this).text(Math.ceil(now));
}
});
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment