需要引用js文件:
<script src="dist/js/jquery.hover3d.js" ></script> <script> $(document).ready(function(){ $(".project").hover3d({ selector: ".project__card", shine: false, }); $(".movie").hover3d({ selector: ".movie__card", shine: true, sensitivity: 20, }); }); </script>页面HTML格式如下:
<div class="project-list"> <div class="project"> <div class="project__card"> <a href="" class="project__image"><img src="400.jpg" width=600 height=400 alt=""></a> <div class="project__detail"> <h2 class="project__title"><a href="#">案例名称</a></h2> <small class="project__category"><a href="#">查看更多</a></small> </div> </div> </div> </div>