简体   繁体   English

jQuery从文本链接缩放外部图像(使用js解决)

[英]jquery zoom external image from text link (solved with js)

I am currently using jquery to zoom images. 我目前正在使用jquery缩放图像。

<figure>
    <img src="images/normal/bambit2.jpg" class="magnify" alt="Bambi-aiheisia koriste-esineitä" />
    <figcaption class="kuvateksti">
        Bambi-aiheisia koriste-esineitä 
    </figcaption>
</figure>

However, i havent figured out, how to magnify image from folder in a same way, by using a hyperlink. 但是,我还没有弄清楚如何通过使用超链接以相同的方式放大文件夹中的图像。 I do not want to load this image as a part of finished page. 我不想将此图像作为完成页面的一部分加载。

<a href=#" rel="magnify[img_at_some_folder]">Click me to see image that is not in this page</a>

If someone could point me in correct destination with this i would be very thankful. 如果有人可以以此指向我正确的目的地,我将非常感激。

[edit] Basically same thing is done here: http://www.dynamicdrive.com/dynamicindex4/imagemagnify.htm at [编辑]基本上可以在这里完成相同的操作: http : //www.dynamicdrive.com/dynamicindex4/imagemagnify.htm

Links that expand a particular "magnify" image 扩展特定“放大”图像的链接

I dont want to load image of Sarah at page, but have the same efect when pressing link "Enlarge Sarah" 我不想在页面上加载Sarah的图像,但是在按下链接“放大Sarah”时具有相同的效果

First you have to specify where the image is coming from and give it an id 首先,您必须指定图片的来源并为其指定ID

<img id="Virtanen" src="ek.gif" class="imagexample" data-magnifyby="5" style="width:200px; height:150px" />

then the hyperlink is as follows 那么超链接如下

<a style="color:blue" href="#" rel="magnify[Virtanen]">Click Me</a>

if you want an image that zooms in to an area of that image then use this code: 如果要放大图像的某个区域,请使用以下代码:

html: 的HTML:

<div id="zt-container" class="zt-container">
<div class="zt-item" data-id="zt-item-1">
    <img class="zt-current" src="images/image1.jpg" />
    <div class="zt-tag" data-dir="1" data-link="zt-item-2" data-zoom="5" data-speed="700" data-delay="50" style="top:138px;left:151px;"></div>
    <div class="zt-tag" data-dir="1" data-link="zt-item-3" data-zoom="6" data-speed="700" data-delay="50" style="top:253px;left:520px;"></div>
</div>
<div class="zt-item" data-id="zt-item-2">
    <img class="zt-current" src="images/image1_1.jpg" />
    <div class="zt-tag zt-tag-back" data-dir="-1" data-link="zt-item-1" data-zoom="5" data-speed="500" data-delay="0"></div>
</div>        
<div class="zt-item" data-id="zt-item-3">
    <img class="zt-current" src="images/image2_2.jpg" />
    <div class="zt-tag zt-tag-back" data-dir="-1" data-link="zt-item-1" data-zoom="6" data-speed="500" data-delay="0"></div>
</div>            

jquery jQuery的

$('#zt-container').zoomtour({
    // if true the tags are rotated depending on their position
    rotation        : true,
    // zoom out animation easing. Example: easeOutBounce , easeOutBack  
    zoominEasing    : '',  
    // zoom out animation easing
    zoomoutEasing   : ''   
});

Source Demo 演示

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM