1. jquery.jqzoom.js
//************************************************************** // jQZoom allows you to realize a small magnifier window,close // to the image or images on your web page easily. // // jqZoom version 2.2 // Author Doc. Ing. Renzi Marco(www.mind-projects.it) // First Release on Dec 05 2007 // i'm looking for a job,pick me up!!! // mail: renzi.mrc@gmail.com //************************************************************** (function ($) { $.fn.jqueryzoom = function (options) { var settings = { xzoom: 200, //zoomed width default width yzoom: 200, //zoomed div default width offset: 10, //zoomed div default offset position: "right",//zoomed div default position,offset position is to the right of the image lens: 1, //zooming lens over the image,by default is 1; preload: 1 }; if (options) { $.extend(settings, options); } var noalt = ''; $(this).hover(function () { var imageLeft = $(this).offset().left; var imageTop = $(this).offset().top; var imageWidth = $(this).children('img').get(0).offsetWidth; var imageHeight = $(this).children('img').get(0).offsetHeight; noalt = $(this).children("img").attr("alt"); var bigimage = $(this).children("img").attr("jqimg"); $(this).children("img").attr("alt", ''); if ($("div.zoomdiv").get().length == 0) { $(this).after("<div class='zoomdiv'><img class="bigimg lazy" src="/static/imghwm/default1.png" data-src="jquery-1.8.2.min.js" + bigimage + "'/ alt="圖片放大鏡jquery.jqzoom.js使用實例附放大鏡圖示_jquery" ></div>"); $(this).append("<div> </div>"); } if (settings.position == "right") { if (imageLeft + imageWidth + settings.offset + settings.xzoom > screen.width) { leftpos = imageLeft - settings.offset - settings.xzoom; } else { leftpos = imageLeft + imageWidth + settings.offset; } } else { leftpos = imageLeft - settings.xzoom - settings.offset; if (leftpos < 0) { leftpos = imageLeft + imageWidth + settings.offset; } } $("div.zoomdiv").css({ top: imageTop, left: leftpos }); $("div.zoomdiv").width(settings.xzoom); $("div.zoomdiv").height(settings.yzoom); $("div.zoomdiv").show(); if (!settings.lens) { $(this).css('cursor', 'crosshair'); } $(document.body).mousemove(function (e) { mouse = new MouseEvent(e); /*$("div.jqZoomPup").hide();*/ var bigwidth = $(".bigimg").get(0).offsetWidth; var bigheight = $(".bigimg").get(0).offsetHeight; var scaley = 'x'; var scalex = 'y'; if (isNaN(scalex) | isNaN(scaley)) { var scalex = (bigwidth / imageWidth); var scaley = (bigheight / imageHeight); $("div.jqZoomPup").width((settings.xzoom) / scalex); $("div.jqZoomPup").height((settings.yzoom) / scaley); if (settings.lens) { $("div.jqZoomPup").css('visibility', 'visible'); } } xpos = mouse.x - $("div.jqZoomPup").width() / 2 - imageLeft; ypos = mouse.y - $("div.jqZoomPup").height() / 2 - imageTop; if (settings.lens) { xpos = (mouse.x - $("div.jqZoomPup").width() / 2 < imageLeft) ? 0 : (mouse.x + $("div.jqZoomPup").width() / 2 > imageWidth + imageLeft) ? (imageWidth - $("div.jqZoomPup").width() - 2) : xpos; ypos = (mouse.y - $("div.jqZoomPup").height() / 2 < imageTop) ? 0 : (mouse.y + $("div.jqZoomPup").height() / 2 > imageHeight + imageTop) ? (imageHeight - $("div.jqZoomPup").height() - 2) : ypos; } if (settings.lens) { $("div.jqZoomPup").css({ top: ypos, left: xpos }); } scrolly = ypos; $("div.zoomdiv").get(0).scrollTop = scrolly * scaley; scrollx = xpos; $("div.zoomdiv").get(0).scrollLeft = (scrollx) * scalex; }); }, function () { $(this).children("img").attr("alt", noalt); $(document.body).unbind("mousemove"); if (settings.lens) { $("div.jqZoomPup").remove(); } $("div.zoomdiv").remove(); }); count = 0; if (settings.preload) { $('body').append("<div style='display:none;' + count + "'>sdsdssdsd</div>"); $(this).each(function () { var imagetopreload = $(this).children("img").attr("jqimg"); var content = jQuery('div.jqPreload' + count + '').html(); jQuery('div.jqPreload' + count + '').html(content + '<img class="bigimg lazy" src="/static/imghwm/default1.png" data-src="jquery-1.8.2.min.js" src=\"' + imagetopreload + '\" alt="圖片放大鏡jquery.jqzoom.js使用實例附放大鏡圖示_jquery" >'); }); } } })(jQuery); function MouseEvent(e) { this.x = e.pageX; this.y = e.pageY; }
2. jqzoom.css
/*jQzoom*/ .jqzoom{ border:1px solid #BBB; float:left; position:relative; padding:0px; cursor:pointer; } div.zoomdiv { z-index: 999; position : absolute; top:0px; left:0px; width : 200px; height : 200px; background: #ffffff; border:1px solid #CCCCCC; display:none; text-align: center; overflow: hidden; } div.jqZoomPup { z-index : 999; visibility : hidden; position : absolute; top:0px; left:0px; width : 50px; height : 50px; border: 1px solid #aaa; background: #ffffff url(../images/zoomlens.gif) 50% top no-repeat; opacity: 0.5; -moz-opacity: 0.5; -khtml-opacity: 0.5; filter: alpha(Opacity=50); }
3. html代碼
<title></title> <script type="text/javascript"></script> <script src="jquery.jqzoom.js" type="text/javascript"></script> <link href="jqzoom.css" rel="stylesheet" type="text/css"> <script type="text/javascript"> /*使用jqzoom*/ $(function() { $(".jqzoom").jqueryzoom({ xzoom: 400, //放大图的宽度(默认是 200) yzoom: 400, //放大图的高度(默认是 200) offset: 10, //离原图的距离(默认是 10) position: "right", //放大图的定位(默认是 "right") preload: 1 }); }); </script> <div class="jqzoom"> <img src="/static/imghwm/default1.png" data-src="images/shoe1_small.jpg" class="lazy" style="max-width:90%" alt="" jqimg="images/shoe1_big.jpg" id="bigImg"> </div>
附件:放大鏡圖示(zoomlens.gif)

JavaScript字符串替換方法詳解及常見問題解答 本文將探討兩種在JavaScript中替換字符串字符的方法:在JavaScript代碼內部替換和在網頁HTML內部替換。 在JavaScript代碼內部替換字符串 最直接的方法是使用replace()方法: str = str.replace("find","replace"); 該方法僅替換第一個匹配項。要替換所有匹配項,需使用正則表達式並添加全局標誌g: str = str.replace(/fi

簡單JavaScript函數用於檢查日期是否有效。 function isValidDate(s) { var bits = s.split('/'); var d = new Date(bits[2] '/' bits[1] '/' bits[0]); return !!(d && (d.getMonth() 1) == bits[1] && d.getDate() == Number(bits[0])); } //測試 var

本文探討如何使用 jQuery 獲取和設置 DOM 元素的內邊距和外邊距值,特別是元素外邊距和內邊距的具體位置。雖然可以使用 CSS 設置元素的內邊距和外邊距,但獲取準確的值可能會比較棘手。 // 設定 $("div.header").css("margin","10px"); $("div.header").css("padding","10px"); 你可能會認為這段代碼很

本文探討了十個特殊的jQuery選項卡和手風琴。 選項卡和手風琴之間的關鍵區別在於其內容面板的顯示和隱藏方式。讓我們深入研究這十個示例。 相關文章:10個jQuery選項卡插件

發現十個傑出的jQuery插件,以提升您的網站的活力和視覺吸引力!這個精選的收藏品提供了不同的功能,從圖像動畫到交互式畫廊。讓我們探索這些強大的工具:相關文章:1

HTTP-Console是一個節點模塊,可為您提供用於執行HTTP命令的命令行接口。不管您是否針對Web服務器,Web Serv

本教程向您展示瞭如何將自定義的Google搜索API集成到您的博客或網站中,提供了比標準WordPress主題搜索功能更精緻的搜索體驗。 令人驚訝的是簡單!您將能夠將搜索限制為Y

當div內容超出容器元素區域時,以下jQuery代碼片段可用於添加滾動條。 (無演示,請直接複製到Firebug中) //D = document //W = window //$ = jQuery var contentArea = $(this), wintop = contentArea.scrollTop(), docheight = $(D).height(), winheight = $(W).height(), divheight = $('#c


熱AI工具

Undresser.AI Undress
人工智慧驅動的應用程序,用於創建逼真的裸體照片

AI Clothes Remover
用於從照片中去除衣服的線上人工智慧工具。

Undress AI Tool
免費脫衣圖片

Clothoff.io
AI脫衣器

AI Hentai Generator
免費產生 AI 無盡。

熱門文章

熱工具

DVWA
Damn Vulnerable Web App (DVWA) 是一個PHP/MySQL的Web應用程序,非常容易受到攻擊。它的主要目標是成為安全專業人員在合法環境中測試自己的技能和工具的輔助工具,幫助Web開發人員更好地理解保護網路應用程式的過程,並幫助教師/學生在課堂環境中教授/學習Web應用程式安全性。 DVWA的目標是透過簡單直接的介面練習一些最常見的Web漏洞,難度各不相同。請注意,該軟體中

Atom編輯器mac版下載
最受歡迎的的開源編輯器

Dreamweaver Mac版
視覺化網頁開發工具

PhpStorm Mac 版本
最新(2018.2.1 )專業的PHP整合開發工具

SecLists
SecLists是最終安全測試人員的伙伴。它是一個包含各種類型清單的集合,這些清單在安全評估過程中經常使用,而且都在一個地方。 SecLists透過方便地提供安全測試人員可能需要的所有列表,幫助提高安全測試的效率和生產力。清單類型包括使用者名稱、密碼、URL、模糊測試有效載荷、敏感資料模式、Web shell等等。測試人員只需將此儲存庫拉到新的測試機上,他就可以存取所需的每種類型的清單。