溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務條款》

js如何實現(xiàn)圖片翻轉效果

發(fā)布時間:2022-03-11 16:47:46 來源:億速云 閱讀:1266 作者:iii 欄目:web開發(fā)

今天小編給大家分享一下js如何實現(xiàn)圖片翻轉效果的相關知識點,內容詳細,邏輯清晰,相信大部分人都還太了解這方面的知識,所以分享這篇文章給大家參考一下,希望大家閱讀完這篇文章后有所收獲,下面我們一起來了解一下吧。

代碼:

<!DOCTYPE html>

<html lang="zh-CN">

<head>

<meta charset="utf-8">

<title>圖片翻轉效果</title>

<link rel="stylesheet" href="css/animate.css">

<style>

* { margin: 0; padding: 0;}

ul { list-style-type: none;}

body { font: 14px "Microsoft Yahei"; overflow-x: hidden; background-color: #2B2B2B; }

h2 { width: 900px; margin: 40px auto 100px; font: 32px "Microsoft Yahei"; text-align: center; color: #D3D3D3; }

</style>

<script src="js/jquery-1.8.3.min.js"></script>

<script>

$(function(){

         var $animate = $('#animate');

         var $opposite = $('#opposite');

         $(".wrap").hover(function(){

                   $animate.removeClass();

                   $opposite.removeClass();

                   $animate.addClass("test");

                   $opposite.addClass('test2');

         },function(){

                   $animate.removeClass();

                   $opposite.removeClass();

                   $animate.addClass("test2");

                   $opposite.addClass('test');

         });

 

         $(".well-item").hover(function(){

                   $(this).find(".correct").children().removeClass();

                   $(this).find(".opposite").children().removeClass();

                   $(this).find(".correct").children().addClass("test");

                   $(this).find(".opposite").children().addClass('test2');

         },function(){

                   $(this).find(".correct").children().removeClass();

                   $(this).find(".opposite").children().removeClass();

                   $(this).find(".correct").children().addClass("test2");

                   $(this).find(".opposite").children().addClass('test');

         });

 

});

</script>

</head>

 

<body>

<h2>圖片翻轉效果</h2>

<div class="well">

         <div class="well-item">

                   <div class="correct"><img  class="" src="images/pro1.jpg" /></div>

                   <div class="opposite">

                            <div class="">

                                     <div class="opposite-content">

                                               <div class="opposite-content-text">

                                                        請我吃烤魚!

                                               </div>

                                     </div>

                            </div>

                   </div>

         </div>

         <div class="well-item">

                   <div class="correct"><img  class="" src="images/pro2.jpg" /></div>

                   <div class="opposite">

                            <div class="">

                                     <div class="opposite-content">

                                               <div class="opposite-content-text">

                                                        請我吃火鍋!

                                               </div>

                                     </div>

                            </div>

                   </div>

         </div>

         <div class="well-item">

                   <div class="correct"><img  class="" src="images/pro3.jpg" /></div>

                   <div class="opposite">

                            <div class="">

                                     <div class="opposite-content">

                                               <div class="opposite-content-text">

                                                        請我吃披薩

                                               </div>

                                     </div>

                            </div>

                   </div>

         </div>

         <div class="well-item">

                   <div class="correct"><img  class="" src="images/pro4.jpg" /></div>

                   <div class="opposite">

                            <div class="">

                                     <div class="opposite-content">

                                               <div class="opposite-content-text">

                                                        請我吃牛排!

                                               </div>

                                     </div>

                            </div>

                   </div>

         </div>

        

</div>

</body>

</html>

以上就是“js如何實現(xiàn)圖片翻轉效果”這篇文章的所有內容,感謝各位的閱讀!相信大家閱讀完這篇文章都有很大的收獲,小編每天都會為大家更新不同的知識,如果還想學習更多的知識,請關注億速云行業(yè)資訊頻道。

向AI問一下細節(jié)

免責聲明:本站發(fā)布的內容(圖片、視頻和文字)以原創(chuàng)、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯(lián)系站長郵箱:is@yisu.com進行舉報,并提供相關證據(jù),一經查實,將立刻刪除涉嫌侵權內容。

js
AI