javascript - I want to create a loader with still image in between the loader circle -
this question has answer here:
- how add icon inside spinner 3 answers
i want create loader still image in between loader circle. in code image rotating along loader want image still not rotating.
<!doctype html> <html> <head> <style> .loader { border: 16px solid #f3f3f3; border-radius: 50%; border-top: 16px solid #3498db; width: 120px; height: 120px; -webkit-animation: spin 2s linear infinite; animation: spin 2s linear infinite; } @-webkit-keyframes spin { 0% { -webkit-transform: rotate(0deg); } 100% { -webkit-transform: rotate(360deg); } } @keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } } </style> </head> <body> <h2>loader image</h2> <p><strong>note:</strong> -webkit- , -ms- prefixes browsers not support animation , transform properties.</p> <div class="loader"> <img id="draweruserimage" class="img-circle" src="https://cdn2.iconfinder.com/data/icons/picol-vector/32/view-128.png"/> </div> </body> </html>
you change using image in wrapper elements background:
.wrapper { width: 152px; height: 152px; } .loader { border: 16px solid #f3f3f3; border-radius: 50%; border-top: 16px solid #3498db; width: 120px; height: 120px; -webkit-animation: spin 2s linear infinite; animation: spin 2s linear infinite; } .wrapper { background: url('https://cdn2.iconfinder.com/data/icons/picol-vector/32/view-128.png') center no-repeat; background-size:50%; } @-webkit-keyframes spin { 0% { -webkit-transform: rotate(0deg); } 100% { -webkit-transform: rotate(360deg); } } @keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }
<div class="wrapper"> <div class="loader"></div> </div>
Comments
Post a Comment