📄 jquery.jqzoom1.0.1.js
字号:
/*
* JQZoom Evolution 1.0.1 - Javascript Image magnifier
*
* Copyright (c) Engineer Renzi Marco(www.mind-projects.it)
*
* $Date: 12-12-2008
*
* ChangeLog:
*
* $License : GPL,so any change to the code you should copy and paste this section,and would be nice to report this to me(renzi.mrc@gmail.com).
*/
(function($)
{
$.fn.jqzoom = function(options)
{
var settings = {
zoomType: 'standard', //standard/reverse/innerzoom
zoomWidth: 200, //zoomed width default width
zoomHeight: 200, //zoomed div default width
xOffset: 10, //zoomed div default offset
yOffset: 0,
position: "right" ,//zoomed div default position,offset position is to the right of the image
lens:true, //zooming lens over the image,by default is 1;
lensReset : false,
imageOpacity: 0.2,
title : true,
alwaysOn: false,
showEffect: 'show',
hideEffect: 'hide',
fadeinSpeed: 'fast',
fadeoutSpeed: 'slow',
preloadImages :true,
showPreload: true,
preloadText : 'Loading zoom',
preloadPosition : 'center' //bycss
};
//extending options
options = options || {};
$.extend(settings, options);
return this.each(function()
{
var a = $(this);
var aTitle = a.attr('title'); //variabile per memorizzare il titolo href
$(a).removeAttr('title');
$(a).css('outline-style','none');
var img = $("img", this);
var imageTitle = img.attr('title');
img.removeAttr('title'); //variabile per memorizzare il titolo immagine
var smallimage = new Smallimage( img );
var smallimagedata = {};
//imageborder
var btop = 0;
var bleft = 0;
var loader = null; //variabile per memorizzare oggetto loader
loader = new Loader();
var ZoomTitle = (trim(aTitle).length > 0) ? aTitle :
(trim(imageTitle).length > 0) ? imageTitle : null; //setting zoomtitle
var ZoomTitleObj = new zoomTitle();
var largeimage = new Largeimage( a[0].href );
var lens = new Lens();
var lensdata = {};
//lensborder
var largeimageloaded = false;
var scale = {}; //rapporto tra immagine grande e piccola scale.x/scale.y
var stage = null; // quadrato che mostra l'immagine ingrandita
var running = false; // running = true quando si verifica l'evento che mostra lo zoom(adesso mouseover).
var mousepos = {};
var firstime = 0;
var preloadshow = false;
var isMouseDown = false;
var dragstatus = false
//loading smallimagedata
smallimage.loadimage();
//ritorna false al click dell href
$(this).click(function(){return false;});
//se settato alwaysOn attivo lo Zoom e lo mostro.
//attivo al mouseover
$(this).hover(function(e)
{
mousepos.x = e.pageX;
mousepos.y = e.pageY;
activate();
},function()
{
deactivate();
});
//ALWAYS ON
if(settings.alwaysOn)
{
setTimeout(function(){activate();},150);
}
function activate()
{
if ( !running ) {
//finding border
smallimage.findborder();
running = true;
//rimuovo il titolo al mouseover
imageTitle = img.attr('title');
img.removeAttr('title');
aTitle = a.attr('title');
$(a).removeAttr('title');
//se non c
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -