简体   繁体   English

更改图库功能

[英]change image gallery function

how i can to make these changes in below code? 我如何在下面的代码中进行这些更改?

  • show thumbnail image title for <div id="main"> when we click, thumb image. 单击时显示<div id="main">缩略图标题,缩略图。
  • show thumbnail image title below of <div id="main"> <div id="main">下面显示缩略图标题
  • set URL thumbnail image for "blank.gif" ( i mean when we click thumb image, <div id="main"> get URL of that thumb image, also. i want make this change for use full-screen of any image) 为“ blank.gif”设置URL缩略图(我的意思是,当我们单击拇指图像时, <div id="main">也会获得该拇指图像的URL。我要进行此更改以使用全屏显示任何图像)

code here: 代码在这里:

<div id="main">
    <p><img src="blank.gif" /></p>
</div>

$(".productthumbs img").click(function() {
    // calclulate large image's URL based on the thumbnail URL (flickr specific)
    var url = $(this).attr("src");
    // get handle to element that wraps the image and make it semitransparent
    var wrap = $("#main").fadeTo("medium", 0.5);
    // the large image from flickr
    var img = new Image();
    // call this function after it's loaded
    img.onload = function() {
        // make wrapper fully visible
        wrap.fadeTo("fast", 1);
        // change the image
        wrap.find("img").attr("src", url);
    };
    // begin loading the image from flickr
    img.src = url;
// when page loads simulate a "click" on the first image
}).filter(":first").click();

I get my answer, put it here for anyone have same asking... 我得到我的答案,把它放在这里给任何有相同疑问的人...

<div id="main">
    <p><img src="blank.gif" /></p>

    <div id="title">
       <a href="about:blank"><h5>...</h5> </a>
    </div>
</div>

and add these lines : 并添加以下行:

wrap.find('h5').html(title);
wrap.find("a").eq(1).attr("href", url);

after : 之后:

    wrap.find("img").attr("src", url);

Good luck. 祝好运。

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

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