How To Flip The Image
Submitted by alpha_luna on Thursday, April 28, 2016 - 11:32.
Good Day!!!
In this tutorial, we are going to learn on How To Flip The Image with jQuery and CSS3. We all know CSS is used to add style to our projects or design to attract the user. And to improve the GUI of the projects. In this case, we use jQuery and CSS3 to flip the image in a horizontal direction. CSS3 transform property that we are going to use to flip images. HTML Source Code This code has a button to flip the image.
jQuery Script
This script will execute after the user clicks the button to flip the image.
- <script src="code_js.js"></script>
- <script type="text/javascript">
- $("#flip_ImageURL").on("click",function(){
- if($("#flip_ImageContainer").css("transform") == 'none') {
- $("#flip_ImageContainer").css("transform","rotateY(180deg)");
- $("#flip_ImageContainer img").attr("src","8.jpg");
- }
- else {
- $("#flip_ImageContainer").css("transform","");
- $("#flip_ImageContainer img").attr("src","24.jpg");
- }
- })
- </script>
- <style type="text/css">
- body {
- margin:auto;
- width:300px;
- }
- #flip_ImageContainer {
- width: 200px;
- height: 150px;
- transition: 0.9s;
- transform-style: preserve-3d;
- position: relative;
- }
- img {
- width:500px;
- }
- .flip_ImageSubmit {
- color: blue;
- background: azure;
- display: inline-block;
- margin-top: 200px;
- padding: 15px;
- cursor: pointer;
- border: blue 1px solid;
- border-radius: 10px;
- font-size: 18px;
- font-weight: bold;
- font-family: cursive;
- }
- </style>
Comments
Add new comment
- Add new comment
- 144 views