-
AuthorPosts
-
September 5, 2014 at 12:42 pm #313980
Hey Team,
I need to change the offset of bootstrap scrollspy.jQuery(‘body’).data()[‘bs.scrollspy’].options.offset;
It is set to 10 and I need it to be 50. Where is this value set? I would prefer a solution that doesn’t overwrite the already set default value.
Thanks in advance.
September 6, 2014 at 3:31 am #314283Hey!
Enfold uses a modified version of ScrollSpy which can be found in js/avia.js, around line 115.
Best regards,
JosueSeptember 6, 2014 at 8:04 am #314418Hey Josue,
thanks for your reply. Ahead of my first post I tried already the following change – without success:avia.js:252
I changed:
$.fn.avia_scrollspy.defaults = {
offset: (parseInt($(‘.html_header_sticky #main’).data(‘scroll-offset’), 10)) + ($(“.html_header_sticky #header_main_alternate”).outerHeight()) + ($(“.html_header_sticky #header_meta”).outerHeight()) + 1 + parseInt($(‘html’).css(‘margin-top’),10),
applyClass: ‘current-menu-item’
}to:
$.fn.avia_scrollspy.defaults = {
offset: 50,
applyClass: ‘current-menu-item’
}The offset value is still 10.
Any suggestions?
Thanks
OleSeptember 10, 2014 at 2:16 pm #316575Hey!
Can we see the site live with the modified function?
Best regards,
DevinSeptember 15, 2014 at 2:31 pm #319199This reply has been marked as private.September 18, 2014 at 8:39 am #320978This reply has been marked as private.September 19, 2014 at 5:57 am #321658Hi Ole,
Can you please create me a WordPress administrator account (or FTP)? post it here as a private reply.
Regards,
JosueSeptember 19, 2014 at 7:04 am #321685This reply has been marked as private.September 19, 2014 at 7:25 am #321690Hey Ole!
I’m unable to edit js/avia.js, but basically what you need to do is modify line 709 on that file:
var target = container.offset().top - fixedMainPadding,
To:
var target = container.offset().top - fixedMainPadding + 50,
That will add some space to the top when the avia_smoothscroll (617) function fires.
Cheers!
JosueSeptember 19, 2014 at 8:27 am #321715This reply has been marked as private.September 19, 2014 at 8:40 am #321725I could note a change (but i think it did the contrary), try using a minus instead:
var target = container.offset().top - fixedMainPadding - 50,
Best regards,
JosueSeptember 22, 2014 at 11:31 am #322917This reply has been marked as private.September 23, 2014 at 1:42 am #323392Hi Ole,
I see it now, try adding this at the very end of your theme / child theme functions.php file:
function change_scrollspy_offset(){ ?> <script> (function($){ $(window).load(function() { $('body').data()['bs.scrollspy'].options.offset = 88; }); })(jQuery); </script> <?php } add_action('wp_footer', 'change_scrollspy_offset');
Regards,
JosueAugust 2, 2015 at 11:34 pm #481837Hi Joseue,
Still no effect. Please check again.
Regards
Gigoz -
AuthorPosts
- The topic ‘Change the offset of bs scrollspy’ is closed to new replies.