For example is there a way to start transitions without interaction from the user?For example is there a way to start transitions without interaction from the user?
Of course there is.! A very basic example is to add a class on <body>
when all page resources have finished loading. This means that when
When <body>
element is created it doesn't have the class. When and when all resources have finished loading, the Window
's onload
event triggers and you. We can use this event to add athe class (i.e.: .loaded
) to <body>
element, at which point, if If a transition is properly defined on body
and the transitioned property changes because of a stronger rule defined under .loaded
selector now applies on the element, the transition will happen. Without any user interaction.