Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

get scroll position jQuery

// Get the current scroll position
let scrollValue = jQuery(window).scrollTop();
console.log('Scroll value: ' + scrollValue); 

// Keep updating the value of the scroll position in the variable
// when a user scrolls it will be updated.
jQuery(window).scroll(
  function()
  {
	let scrollValue = jQuery(window).scrollTop();
	console.log('Scroll value: ' + scrollValue);    
  }
);
Comment

jquery scroll to position

jQuery(document).ready(function($) {
  $('a[href^="#"]').bind('click.smoothscroll',function (e) {
    e.preventDefault();
    var target = this.hash,
        $target = $(target);

    $('html, body').stop().animate( {
      'scrollTop': $target.offset().top-40
    }, 900, 'swing', function () {
      window.location.hash = target;
    } );
  } );
} );
Comment

PREVIOUS NEXT
Code Example
Javascript :: check object has value 
Javascript :: nuxt 18 mountend route push 
Javascript :: jquerygrid disable sorting 
Javascript :: nodejs to exe 
Javascript :: create react app and tailwind 
Javascript :: js rounding 
Javascript :: javascript clear symbols 
Javascript :: react data attributes event 
Javascript :: array to comma separated list js 
Javascript :: javascript remoev css class 
Javascript :: max value in array javascript 
Javascript :: run function once domcontentloaded javascript 
Javascript :: default ordering of datatable to be removed 
Javascript :: javascript loop through all element children 
Javascript :: inject javascript to webpage 
Javascript :: missing from-clause entry for table sequelize limit 
Javascript :: javascript random letter generator 
Javascript :: laravel variable in javascript 
Javascript :: disable copy past jquery 
Javascript :: how to remove the last character from a string in javascript 
Javascript :: remove attribute javascript 
Javascript :: class MyComponent extends React.Component { } ... what is the ES5 equivalent of this * 
Javascript :: react function with form 
Javascript :: how to call a javascript function in html without any event 
Javascript :: javascript replace all spaces with dashes 
Javascript :: react native center text vertically full screen 
Javascript :: vue input file image preview 
Javascript :: express urlencoded 
Javascript :: angular schematics datatable 
Javascript :: subtract 18 years from today javascript 
ADD CONTENT
Topic
Content
Source link
Name
9+9 =