SRefocusFeature

This feature allows you to automatically visually refocus an element that is inside a scrollable one on different trigger(s) like events, etc... This feature will occurs on these actions:

  • At page display, check the anchor and refocus if found an element with the correct id
  • At some events like: popstate, hashchange and pushstate.
  • Note that the "pushstate" event is emitted by a proxies history.pushState method.
  • In order to make the refocus happend, your pushed state MUST have the scroll property to true
  • On any events specified in the props.trigger property using this syntax: event:click, etc...
Platform  
js
   â”‚    Support  
Chromium supported
Firefox supported
Safari supported
Edge supported
Since  2.0.0
   â”‚   
Olivier Bossel
Olivier Bossel
   â”‚   
beta

  Preview

Simple usage

 

Loading code example. Please wait...

  Import

  Install

  Interface

  1. trigger
    []
    • event:eventName
    • anchor
    • history
    Array<String>

    Specify some trigger(s) on which to refocus a particular element like event:actual, anchor, history, etc...

  2. timeout
    500
    Number

    Specify a timeout to wait before refocus the element

  3. duration
    Number

    Specify the duration of the refocus animation

  4. easing
    Function

    Specify the easing function of the refocus animation

  5. focusedClass
    focused
    String|Boolean

    Specify the class to add when the target element has been focused

  6. focusedClassDuration
    1000
    Number

    Specify how many ms the focused class has to be added, then removed

  7. offset
    Number

    Specify the offset of the refocus animation in px

  8. offsetX
    Number

    Specify the offset x of the refocus animation in px

  9. offsetY
    Number

    Specify the offset y of the refocus animation in px

  10. align
    • start
    • center
    • end
    String

    Specify the alignment of the refocus animation

  11. justify
    • start
    • center
    • end
    String

    Specify the justification of the refocus animation

Bugs
are not our friends...

Don't hesitate to declare an issue if something does not works as expected.

Declare my issue on Github Talk about it on Discord

The more we are,
the stronger we become.

Don't hesitate to tell some words to you friends about us. The goal is to became more and more each days to help each others...

Support us on Patreon! Share on Facebook! Make a tweet!

The more we are,
the stronger we become.

Don't be afraid to join us on Discord.

Join us on discord!

We love,
Open source!

All of our codebase can be found on Github. We hope that you may contribute to help us make our tools even better!

Discover our codebase!

Welcome on