• The link on arrow in Section activate a scroll to next section, but the scroll is abrupt and uneven. But the scroll of Menu link is beautiful!
    Could I use the same script/routine?

    thanks

Viewing 1 replies (of 1 total)
  • Matt

    (@mugwumpman)

    I have been trying exactly the same thing! Looking at the following bit of code seeing if it can be modified to include the class ‘scroll’…

    // sticky menu
    
    (function($){
    	$.fn.sticky = function( options ) {
    		// adding a class to users div
    		$(this).addClass('sticky-header')
    		var settings = $.extend({
                'scrollSpeed '  : 500
                }, options);
    
    		return $('.sticky-header .home-navigation ul li a').each( function() {
    
    			if ( settings.scrollSpeed ) {
    
    				var scrollSpeed = settings.scrollSpeed
    
    			}
    
    			  if(jQuery("body.admin-bar").length){
    		if(jQuery(window).width() < 765) {
    				stickyTop = 46;
    
    			} else {
    				stickyTop = 32;
    			}
    	  }
    	  else{
    		  stickyTop = 0;
    		  }
    		  $(this).css({'top':stickyTop});
    
    			var stickyMenu = function(){
    
    				var scrollTop = $(window).scrollTop();
    				if (scrollTop > stickyTop) {
    					$('.sticky-header').css({ 'position': 'fixed'/*, 'top':stickyTop*/ }).addClass('fxd');
    					} else {
    						$('.sticky-header').css({ 'position': 'absolute'/*, 'top':0*/ }).removeClass('fxd');
    					}
    			};
    			stickyMenu();
    			$(window).scroll(function() {
    				 stickyMenu();
    			});
    			  $(this).on('click', function(e){
    				var selectorHeight = $('.sticky-header').height();
    				e.preventDefault();
    		 		var id = $(this).attr('id');
    				if(typeof $('section.'+ id).offset() !== 'undefined'){
    				var goTo =  $('section.'+ id).offset().top -selectorHeight;
    				$("html, body").animate({ scrollTop: goTo }, scrollSpeed);
    				}
    
    			});	
    
    		});
    
    	}
    
    })(jQuery);
    
    jQuery(document).ready(function(){
    
    /* ------------------------------------------------------------------------ */
    /*  sticky header             	  								  	    */
    /* ------------------------------------------------------------------------ */
    
     jQuery('.home-header').sticky({'scrollSpeed' : 1000 });
Viewing 1 replies (of 1 total)
  • The topic ‘Abrupt scroll in arrow link, unlike the scroll menu’ is closed to new replies.