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 :: nodejs write to log file 
Javascript :: change color react icon 
Javascript :: node powershell 
Javascript :: socket..io 
Javascript :: react router dom props.history is undefined 
Javascript :: convert string to lowercase javascript 
Javascript :: show a div in jquery 
Javascript :: js string replace array 
Javascript :: array destructuring in react 
Javascript :: javascript get cursor position without event 
Javascript :: react POST ERROR HANDLING 
Javascript :: mongoose connection increase timeout in node js 
Javascript :: array values js 
Javascript :: js setinterval vs settimeout 
Javascript :: mongoose where 
Javascript :: vuelidate required if another props 
Javascript :: javascript html video seek to time 
Javascript :: js innerhtml 
Javascript :: Learn how to use Js export and import. 
Javascript :: combine the values of 2 arrays in key = value jquery 
Javascript :: how to create date object with specific time in moment js 
Javascript :: js comments 
Javascript :: proxy nuxt 
Javascript :: super class js 
Javascript :: how to stop canvas resizing from resizing images 
Javascript :: define value in js 
Javascript :: Making promises 
Javascript :: select multiple id in jquery 
Javascript :: javascript telegram bot 
Javascript :: md 5 npm 
ADD CONTENT
Topic
Content
Source link
Name
8+7 =