Skip to content

Scroll API

Arthur Guiot edited this page Jul 25, 2017 · 1 revision

$.scroll()

This function will accept 1 argument:

  • callback - The function that will be called each time you scroll.

Example

JS:

$.scroll(function() {
    console.log("Scrolling");
});

$.scrollTo()

This function will accept 2 arguments:

  • x - The value of the x axis on the web page in px.
  • y - The value of the y axis on the web page in px.

Example

JS:

$.on($.s(document.body), "click", function() {
    $.scrollTo(100, 100) // will go to 100px, 100px
});

$.scrollTop()

This function will accept 1 argument:

  • el (optional) - The element you want to know the distance to its top. By default it refers to document.body

This function will return you a value in px

Example

JS:

$.scrollTop() // some value in px

⚠️ Questions?

Don't hesitate to ask your questions ⁉️ in the issue part 😁

Clone this wiki locally