このエフェクトは、jQuery と CSS を使用して画像リストを実装します。マウスを内側に移動すると、画像がわずかに左に移動し、マウスを外側に移動すると元に戻ります。
jQueryイベントはmouseenterとmouseleaveを使用し、イベントバインディングメソッドは新しく推奨されたonメソッドを使用します。
コードは次のとおりです:
<!DOCTYPE html> <html> <head><meta name="viewport" content="width=device-width, initial-scale=1" /> <title>jQuery实现图片列表鼠标移入微动_何问起</title><base target="_blank" /> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <style type="text/css"> body, p, li, p, img, a { margin: 0; padding: 0; } .hovertreecontainer { width: 370px; margin: 50px auto; } .hovertreecontainer a { text-decoration: none; } .hovertree-item-box { height: 120px; width: 185px; position: relative; padding: 10px; box-sizing: border-box; float: left; } .hovertree-item-box .title { width: 80px; height: 100%; color: #4998a1; font-size: 14px; } .hovertree-item-box.odd { border-bottom: 1px solid #CCC; border-right: 1px solid #CCC; } .hovertree-item-box.even { border-bottom: 1px solid #CCC; } .hovertree-item-box.nobottom { border-bottom: none; } .hovertree-item-box .hovertree-img-box { width: 80px; height: 80px; overflow: hidden; position: absolute; right: 10px; bottom: 5px; } .hovertree-img-box img { width: 100%; height: 100%; } .hovertreecontainer:after { content: ""; display: block; clear: both; } </style> </head> <body> <p class="hovertreecontainer"><h2 id="jQuery实现图片列表鼠标移入微动">jQuery实现图片列表鼠标移入微动</h2> <a href="http://hovertree.com/texiao/css/20/"> <p class="hovertree-item-box odd"> <p class="title">春节对联</p> <p class="hovertree-img-box"><img src="/static/imghwm/default1.png" data-src="http://hovertree.com/hvtimg/201512/o9qashmi.gif" class="lazy" alt="jqueryはマウスが画像リスト内に移動するときの微小な動きを実装します" ></p> </p> </a> <a href="http://hovertree.com/hvtart/bjae/a6w6e2qg.htm"> <p class="hovertree-item-box even"> <p class="title">下雨天</p> <p class="hovertree-img-box"><img src="/static/imghwm/default1.png" data-src="http://hovertree.com/hvtimg/201512/f748s0ko.jpg" class="lazy" alt="jqueryはマウスが画像リスト内に移動するときの微小な動きを実装します" ></p> </p> </a> <a href="http://hovertree.com/h/bjae/0st5ww13.htm"> <p class="hovertree-item-box odd"> <p class="title">磨砂玻璃</p> <p class="hovertree-img-box"><img src="/static/imghwm/default1.png" data-src="http://hovertree.com/hvtimg/201512/agagq0or.jpg" class="lazy" alt="jqueryはマウスが画像リスト内に移動するときの微小な動きを実装します" ></p> </p> </a> <a href="http://hovertree.com/menu/texiao/"> <p class="hovertree-item-box even"> <p class="title">网页特效</p> <p class="hovertree-img-box"><img src="/static/imghwm/default1.png" data-src="http://hovertree.com/hvtimg/201512/r51a22uy.gif" class="lazy" alt="jqueryはマウスが画像リスト内に移動するときの微小な動きを実装します" ></p> </p> </a> <a href="http://hovertree.com/h/bjaf/hwqtjwjs.htm"> <p class="hovertree-item-box odd nobottom"> <p class="title">何问起统计文件数</p> <p class="hovertree-img-box"><img src="/static/imghwm/default1.png" data-src="http://hovertree.com/hvtimg/bjafjd/iofopnro.png" class="lazy" alt="jqueryはマウスが画像リスト内に移動するときの微小な動きを実装します" ></p> </p> </a> <a href="http://hovertree.com/h/bjaf/hovertreeimg.htm"> <p class="hovertree-item-box even nobottom"> <p class="title">HovertreeImg</p> <p class="hovertree-img-box"><img src="/static/imghwm/default1.png" data-src="http://hovertree.com/hvtimg/201601/p3t2ldyr.png" class="lazy" alt="jqueryはマウスが画像リスト内に移動するときの微小な動きを実装します" ></p> </p> </a> <p><a href="http://hovertree.com/h/bjaf/4mv4wgmj.htm">原文</a> <a href="http://hovertree.com">首页</a> <a href="http://hovertree.com/menu/texiao/">特效</a></p> </p> <script type="text/javascript" src="http://down.hovertree.com/jquery/jquery-1.11.3.min.js"></script> <script type="text/javascript"> $(function () { $('.hovertreecontainer .hover'+'tree-item-box').on('mouseenter', function (ev) { var oImgBox = $(this).find('.hovertree-img-box'); $(oImgBox).stop(true).animate({ right: '20px' }, "normal"); }).on('mouseleave', function (ev) { var oImgBox = $(this).find('.hovertree-img-box'); $(oImgBox).stop(true).animate({ right: '10px' }, "normal"); }); }); </script> </body> </html>
声明
この記事の内容はネチズンが自主的に寄稿したものであり、著作権は原著者に帰属します。このサイトは、それに相当する法的責任を負いません。盗作または侵害の疑いのあるコンテンツを見つけた場合は、admin@php.cn までご連絡ください。

ホットAIツール

Undresser.AI Undress
リアルなヌード写真を作成する AI 搭載アプリ

AI Clothes Remover
写真から衣服を削除するオンライン AI ツール。

Undress AI Tool
脱衣画像を無料で

Clothoff.io
AI衣類リムーバー

Video Face Swap
完全無料の AI 顔交換ツールを使用して、あらゆるビデオの顔を簡単に交換できます。

人気の記事
アサシンのクリードシャドウズ:シーシェルリドルソリューション
4週間前ByDDD
Atomfallのクレーンコントロールキーカードを見つける場所
4週間前ByDDD
<🎜>:Dead Rails-すべての課題を完了する方法
1 か月前ByDDD
Atomfall Guide:アイテムの場所、クエストガイド、およびヒント
1 か月前ByDDD

ホットツール

ZendStudio 13.5.1 Mac
強力な PHP 統合開発環境

SublimeText3 英語版
推奨: Win バージョン、コードプロンプトをサポート!

メモ帳++7.3.1
使いやすく無料のコードエディター

SAP NetWeaver Server Adapter for Eclipse
Eclipse を SAP NetWeaver アプリケーション サーバーと統合します。

WebStorm Mac版
便利なJavaScript開発ツール

ホットトピック
Gmailメールのログイン入り口はどこですか?
7698
15


Java チュートリアル
1640
14


CakePHP チュートリアル
1393
52


Laravel チュートリアル
1287
25


PHP チュートリアル
1230
29

