The Google Doodle is an artistic version of the Google logo. Google Doodles represent events like holidays, anniversaries, or current events. Some of the doodles were limited to Google's country specific home pages while others appeared globally. Doodles are the fun, surprising, and sometimes spontaneous changes that are made to the Google logo to celebrate holidays, anniversaries, and the lives of famous artists, pioneers, and scientists. and here we are going to see simple way to code like google doodle style animation using javascript. lets see the coding.
Normally first image will be .png and animated image will come on the click in google doodles.. like that we are going to see here. For that we need two images.
1. normal .png format or .jpg image
2. animated .gif image
In 1998, before the company was even incorporated, the concept of the doodle was born when Google founders Larry and Sergey played with the corporate logo to indicate their attendance at the Burning Man festival in the Nevada desert.
HTML CODE
<div class="container"> <a href="#" id="doodle" title="Click to play"> <img class="first-img" src="new-year-std.png"> </a> <a href="http://2my4edge.com" title="New year 2015"> <img class="second-img" id="newyear" src="new-year-animated.gif"> </a> </div>
first image is .png or .jpg image to standard view with play button, and the second image is animated .gif image. to animate the image after the click.
JAVA SCRIPT
<script src="//code.jquery.com/jquery-1.11.2.min.js"></script> <script> $(document).on('click','#doodle',function(){ $('.first-img').hide(); $('#newyear').removeClass('second-img'); return false; }); </script>
here we need jquery library file to make this operation.
CSS
* { padding:0; margin:0;} .container { width:600px; margin:0 auto; text-align:center; } img { width:450px; margin:0 auto; text-align:center; } .second-img { display: none; }
here we are making display:none; of second image. before click the first image. i hope this one is really simple and helpful to you like google like doodle style animation on click. Thank you.
RELATED POSTS :
Image slider with random animation effects using Jquery
Image gallery with lightbox effect using Jquery
Drag and Drop Concept using Jquery
Dynamic Data Table using DataTable Jquery
Vertical news ticker using vTicker Jquery
Web camera snap using snap.js Jquery
Gird and List style view onclick by using Jquery
Simple form validation using validate.js with jquery
Go back to previous and next page onClick in browser using Javascript
Set current time using javascript for websites
No comments:
Post a Comment