SSugarFeature
This feature allows you to apply some "nice to have" features like having a "scrolled" class applied on the body
when the user has scroll in the page or having access to a --vh
css variable that represent the exact
viewport innerHeight and avoid having issues with mobile different viewport height values. Note that if you use
the sPostcssSugarPlugin
postcss plugin, you can use the vh
unit as normal and if will automatically take the
value of the --vh
variable if it exists.
More feature can be added in the future depending on the needs.
Preview
Simple usage
Simply add the s-sugar
property on your body tag
Loading code example. Please wait...
Features
-
Support for "pleasant css" syntax like "s-btn:outline"
-
Polyfill for container queries if needed
-
scrolled
class applied on the body when the user has scrolled the page -
Access to a
--vh
css variable that represent the exact viewport innerHeight and avoid having issues with mobile different viewport height values -
Clear all transitions and animations on all the page during a window resize. Helps for performances and cleaner for user
-
Additional input attributes like
empty
,dirty
andhas-value
-
Add state attributes to links like
actual
andactual-child
depending on the document location url -
Prevent the scroll restoration behavior on chrome that can usually be anoying
-
Remove some classes at page loading end: "initial-loading", "loading"
-
Proxy the
history.pushState
method to make it dispatch an "pushstate" event with the actual state as detail
Import
Install
Interface
-
pleasantCsstrueBoolean
Specify if you want the "pleasant css" syntax in your pages
-
containerQuerytrueBoolean
Specify if you want support for container queries in your css or not
-
scrolledtrueBoolean
Specify if you want the
scrolled
class to be applied on thebody
element when the page has been scrolled -
scrolledDelta200Number
Specify after how many scroll the scrolled class will be applied
-
vhvartrueBoolean
Specify if you want the
--vh
css variable to be computed and available -
inputAdditionalAttributestrueBoolean
Specify if you want to have the additional attributes on inputs like "has-value", "empty" and "dirty" or not
-
resizeTransmationstrueBoolean
Specify if you want all the transitions and animations cleared during window resize
-
linksStateAttributestrueBoolean
Specify if you want to have the state attributes on links like "actual" and "actual-child" or not
-
preventScrollRestorationtrueBoolean
Specify if you want to prevent the scroll restoration behavior on chrome that can usually be anoying
-
envtrueBoolean
Specify if you want to display the current environment at start