Files
old-gravityforms/js/floatmenu_init.js
Almira Krdzic d86f748bc6 Initial commit
2018-08-06 15:18:02 +02:00

19 lines
606 B
JavaScript

// change the menu position based on the scroll position
window.onscroll = function() {
var toolbar = jQuery( '#gf_form_toolbar' );
var floatMenu = jQuery( '#floatMenu' );
if( window.XMLHttpRequest && toolbar.length > 0 ) {
var basePosition = toolbar.offset().top;
if( document.documentElement.scrollTop > basePosition || self.pageYOffset > basePosition ) {
floatMenu.css( { position: 'fixed', top: '40px' } );
} else {
floatMenu.css( { position: 'static', top: '40px' } );
}
}
}