New Landing How can we help? Themeforest Theme Support Dante Add 'smooth scroll' to icon box links?

Viewing 4 posts - 1 through 4 (of 4 total)
  • Posted in: Dante
  • #286084
    rolandcs
    Member
    Post count: 2

    I’m using an Icon Box and am linking it to an anchor on the same page. I would like this to smooth scroll. I have added the ‘smooth-scroll-link class’ to the “Extra Class Name” section in the editor, but smooth scrolling doesn’t work. Any ideas?

    #286208
    Mohammad – SUPPORT
    Moderator
    Post count: 27441

    Hi,
    Pleae go to Admin > Theme Options > Custom CSS/JS > Custom JS > Paste given below code:-

    
    <script>
    jQuery('a.linked-icon').on('click', function(e) {
    				
    				var linkHref = jQuery(this).attr('href');
    								
    				if (linkHref.indexOf('#') === 0) {
    					var spacerHeight = jQuery(linkHref).height(),
    						headerHeight = 0;
    						
    					if (jQuery('.sticky-header').length > 0) {
    						headerHeight = jQuery('.sticky-header').height();
    					}
    					if (jQuery('#wpadminbar').length > 0) {
    						headerHeight = headerHeight + 28;
    					}
    					
    					jQuery('html, body').stop().animate({
    						scrollTop: jQuery(linkHref).offset().top + spacerHeight - headerHeight - 10
    					}, 1000, 'easeInOutExpo');
    					
    					e.preventDefault();
    					
    				} else {
    					return e;
    				}
    				
    			});
    </script>
    

    Thanks
    Mohammad

    #286254
    rolandcs
    Member
    Post count: 2

    Perfect – thank you!

    #286255
    Mohammad – SUPPORT
    Moderator
    Post count: 27441

    Hi,
    Glad 🙂 to help you.
    Thanks
    Mohammad

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in and have valid license to reply to this topic.

License required for one of the following items
Login and Registration Log in · Register