實(shí)例如下所示:
成都創(chuàng)新互聯(lián)專業(yè)為企業(yè)提供介休網(wǎng)站建設(shè)、介休做網(wǎng)站、介休網(wǎng)站設(shè)計(jì)、介休網(wǎng)站制作等企業(yè)網(wǎng)站建設(shè)、網(wǎng)頁設(shè)計(jì)與制作、介休企業(yè)網(wǎng)站模板建站服務(wù),十多年介休做網(wǎng)站經(jīng)驗(yàn),不只是建網(wǎng)站,更提供有價(jià)值的思路和整體網(wǎng)絡(luò)服務(wù)。
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>圖片提示</title> <!--jQuery --> <script src="../jquery.min.js"type="text/javascript"></script> <style type="text/css"> body{ margin:0; padding:40px; background:#fff; font:80% Arial, Helvetica, sans-serif; color:#555; line-height:180%; } img{border:none;} ul,li{ margin:0; padding:0; } li{ list-style:none; float:left; display:inline; margin-right:10px; border:1px solid #AAAAAA; } /* tooltip */ #tooltip{ position:absolute; border:1px solid #ccc; background:#333; padding:2px; display:none; color:#fff; } </style> <script type="text/javascript"> $(document).ready(function(){ var x=1,y=1; var myHref; $("a[class=tooltip]").mouseover(function(e){//鼠標(biāo)懸停的時(shí)候 myHref=this.href;//獲取大圖片 var $div=$("<div id='tooltip'><img src='"+myHref+"'></img></div>");//創(chuàng)建一個(gè)div $("body").append($div);//把div添加到body中 $("#tooltip").css({ top:e.pageY+y+"px", left:e.pageX+x+"px" }).show("slow"); }).mouseout(function(e){//鼠標(biāo)移開的時(shí)候 $("#tooltip").remove(); }).mousemove(function(e){//鼠標(biāo)移動的時(shí)候 $("#tooltip").css({ top:e.pageY+y+"px", left:e.pageX+x+"px" }).show("slow"); }) }); </script> </head> <body> <ul> <li><a href="02121.png" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" class="tooltip" ><img src="02121.png" /></a></li> <li><a href="02121.png" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" class="tooltip" ><img src="02121.png" /></a></li> <li><a href="02121.png" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" class="tooltip" ><img src="02121.png" /></a></li> <li><a href="02121.png" rel="external nofollow" rel="external nofollow" rel="external nofollow" rel="external nofollow" class="tooltip" ><img src="02121.png" /></a></li> </ul> <br/><br/><br/><br/> <br/><br/><br/><br/> </body> </html>
以上這篇JavaScript通過mouseover()實(shí)現(xiàn)圖片變大效果的示例就是小編分享給大家的全部內(nèi)容了,希望能給大家一個(gè)參考,也希望大家多多支持創(chuàng)新互聯(lián)。
網(wǎng)頁名稱:JavaScript通過mouseover()實(shí)現(xiàn)圖片變大效果的示例
路徑分享:http://jinyejixie.com/article38/gdjpsp.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供做網(wǎng)站、外貿(mào)網(wǎng)站建設(shè)、虛擬主機(jī)、網(wǎng)站排名、小程序開發(fā)、自適應(yīng)網(wǎng)站
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來源: 創(chuàng)新互聯(lián)