As mentioned in the comments, the code in question added transition and a transition-delay elements to the target element, but the transition did not occur.
A transition can only occur when a state changes, either due to user interaction, such as :hover :focus , etc., or because of scripts such as adding a class on click or timeout, etc. Therefore, transitions are not suitable for your purpose, and you should use animation instead. Animations can automatically start when a page loads, unlike transition .
In order for the element to be blurred after a delay of 1 s when loading the page, set the initial state of the element to an uneven state, and then leave it to blurred state, as in the fragment below.
#target{ height: 100px; width: 500px; background: url(http://lorempixel.com/500/100); } .blur { -webkit-animation: blur 0.5s linear forwards; -moz-animation: blur 0.5s linear forwards; -ms-animation: blur 0.5s linear forwards; -o-animation: blur 0.5s linear forwards; animation: blur 0.5s linear forwards; -webkit-animation-delay: 1s; -moz-animation-delay: 1s; animation-delay: 1s; } .delay { -webkit-animation-delay: 1s; -moz-animation-delay: 1s; animation-delay: 1s; } @-webkit-keyframes blur { to { -webkit-filter: blur(5px); filter: blur(5px); } } @-moz-keyframes blur { to { -moz-filter: blur(5px); filter: blur(5px); } } @keyframes blur { to { -webkit-filter: blur(5px); -moz-filter: blur(5px); filter: blur(5px); } }
<div class="main"> <div class="wrapper"> <div id="target" class="blur">This element has a background-image, which should be blured</div> </div> <div class="content-layer"> <input id="searchMain" class="animated fadeIn delay"> </div> </div>
source share