-
AuthorPosts
-
December 17, 2014 at 7:17 am #166312
mingParticipantHi X,
I’d like to use smooth scroll to jump to anchors. It works perfect using this code:
jQuery(document).ready(function(){ jQuery('a[href^="#"]').on('click',function (e) { e.preventDefault(); var target = this.hash; $target = jQuery(target); jQuery('html, body').stop().animate({ 'scrollTop': $target.offset().top-100 }, 900, 'swing', function () { window.location.hash = target; }); }); });unfortunately this function also takes effect on the accordions i use!
How do I exclude accordions from that function?
thanks!
December 17, 2014 at 12:00 pm #166528
ZeshanMemberHi there,
Thanks for writing in!
You can use following code instead:
jQuery(document).ready(function(){ jQuery('a[href^="#"]:not(.x-accordion-toggle)').on('click',function (e) { e.preventDefault(); var target = this.hash; $target = jQuery(target); jQuery('html, body').stop().animate({ 'scrollTop': $target.offset().top-100 }, 900, 'swing', function () { window.location.hash = target; }); }); });Hope this helps. 🙂
Thank you.
-
AuthorPosts
- <script> jQuery(function($){ $("#no-reply-166312 .bbp-template-notice, .bbp-no-topic .bbp-template-notice").removeClass('bbp-template-notice'); }); </script>
