jquery - is it possible to animate and remove the pseudo content from a element..? -
i have button, when user click on button, adding "tick" mark on button using pseudo content :before, works fine.
but need remove :before property fadeout() 2sec. possible that?
here button css code:
button{ border: 1px solid #1f85c3; height: 30px; color: #fff; padding: .4em 1em !important; background-image: linear-gradient(#1f96d0, #007cc2); position: relative; display: block; padding-right: 30px !important; } on click adding class name right:
button.right:before{ content: ''; position: absolute; top: 50%; right: 0%; margin: -7px 0 0 -10px; height: 5px; width: 16px; border: solid #fff; border-width: 0 0 5px 5px; -webkit-transform: rotate(-45deg); -moz-transform: rotate(-45deg); -ms-transform: rotate(-45deg); -o-transform: rotate(-45deg); transform: rotate(-45deg); -webkit-box-shadow: -1px 1px 1px rgba(0, 0, 0, 0.4); box-shadow: -1px 1px 1px rgba(0, 0, 0, 0.4); } any advice please?
since adding right class on click, create empty :before pseudo-element button , use transitions
button:before{ content:''; opacity:1; transition:opacity 2s linear; } and add opacity:0 button.right:before rule.
button.right:before{ content: ''; position: absolute; top: 50%; right: 0%; margin: -7px 0 0 -10px; height: 5px; width: 16px; border: solid #fff; border-width: 0 0 5px 5px; -webkit-transform: rotate(-45deg); -moz-transform: rotate(-45deg); -ms-transform: rotate(-45deg); -o-transform: rotate(-45deg); transform: rotate(-45deg); -webkit-box-shadow: -1px 1px 1px rgba(0, 0, 0, 0.4); box-shadow: -1px 1px 1px rgba(0, 0, 0, 0.4); opacity:0; } demo at http://jsfiddle.net/syq89/
(i have added standard property transitions, should add vendor specific prefixes if required..)
Comments
Post a Comment