【问题标题】:gallery image to open in a selected page在选定页面中打开的图库图像
【发布时间】:2013-04-17 18:48:18
【问题描述】:

我有一个缩略图库,我想在带有反向链接的预览页面中打开每个大图像。请建议我该怎么做。

html

<ul>
    <li>
        <a href="big image link"><img src="thumb nail image"/></a>
    </li>
    <li>
        <a href="big image link"><img src="thumb nail image"/></a>
    </li>
    ....
</ul>

想在预览页面中打开大图 html

<div>
    <a href="back">Go back</a>
    <img src="holder for big image" />
</div>

请建议..

【问题讨论】:

  • 你为什么不使用overlay的..
  • 我不想使用灯箱。尝试使用 jquery 但不起作用,我是 jquery 的新手,需要您的建议。

标签: jquery html css jquery-mobile thumbnails


【解决方案1】:

如果你想使用 jquery,这会让你开始:

html:

<div id="holder"></div>
<ul><li><img class="pointer" src="http://bit.ly/Yx18em"/></li></ul>

css:

#holder{
    position: absolute;
    display: none;
}

li{
    list-style: none;
}

li img{
    width:25px;
    height: auto;
}

.pointer{
    cursor: pointer;
    cursor: hand;
}

jquery:

$("ul img").click(function() {
  $('#holder').html(
      '<img src="'+$(this).attr('src') 
      +'"><span id="close" class="pointer">back</span>'
  ).show();
  $("#close").click(function() {
      $(this).parent().hide();
  });  
});

工作示例:http://jsfiddle.net/qLEZ6/2/

【讨论】:

【解决方案2】:

如何使用插件 Photoswipe

this 示例准确地展示了您正在寻找的内容。

【讨论】:

    猜你喜欢
    • 2023-03-18
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多