Hi
I’m using the Pro header construction on my site. In the top section I have a button that links to the first section of the page. My problem is that when it scrolls down to the section it is cutting off the top of the section where the headline is.
Can you please help?
http://deafhistory.creativemindsdesign.com.au
Thanks
Hi there,
Thanks for writing in.
It’s not supported by Pro header yet since it can be composed with many different bars and elements, but you may add this code to your global custom javascript.
jQuery ( document ).ready( function($) {
setTimeout ( function() {
$('.x-anchor.x-anchor-button[href*="#"]').off();
$(document).on('click', '.x-anchor.x-anchor-button[href*="#"]', function(e) {
e.preventDefault();
console.log( $(this).attr('href') );
var hash = '#' + $(this).attr('href').split('#')[1];
if ( hash == '#' ) return false;
$('html, body').stop().animate({ scrollTop : $(hash).offset().top - $('.hm12').height() });
} );
}, 500 );
} );
That should do the proper offset scrolling, but this will only work on your current setup. If you change your header then it will not work and we’’ not provide support for custom codes. This is just a little snippet that you can enhance, please use it with caution.
Thanks!
Hi Rad,
This works a treat. Thanks heaps!
You are welcome!