图片上的jQuery Zoom插件点击

Abd*_*lah 2 html javascript css jquery

我在网上进行了大量搜索,但未找到所需的解决方案,我想显示与大图像相同的图像(表示当我单击图像时,它使用缩放选项等显示与大图像相同的图像),请帮我,而解决方案是在HTML,css,js或jquery插件中,我只需要一个解决方案。

Rok*_*jan 5

使用叠加DIV作为灯箱的基本且简单的方法:

// Image to Lightbox Overlay 
$('img').on('click', function() {
  $('#overlay')
    .css({backgroundImage: `url(${this.src})`})
    .addClass('open')
    .one('click', function() { $(this).removeClass('open'); });
});
Run Code Online (Sandbox Code Playgroud)
img{height:100px;}

#overlay{
  position: fixed;
  top:0;
  left:0;
  width:100%;
  height:100%;
  background: rgba(0,0,0,0.8) none 50% / contain no-repeat;
  cursor: pointer;
  transition: 0.3s;
  
  visibility: hidden;
  opacity: 0;
}
#overlay.open {
  visibility: visible;
  opacity: 1;
}

#overlay:after { /* X button icon */
  content: "\2715";
  position: absolute;
  color:#fff;
  top: 10px;
  right:20px;
  font-size: 2em;
}
Run Code Online (Sandbox Code Playgroud)
<div id="overlay"></div>
<img src="http://placehold.it/500x400/0bf">
<img src="http://placehold.it/500x400/f0b"> 
<script src="//code.jquery.com/jquery-3.1.0.js"></script>
Run Code Online (Sandbox Code Playgroud)


小智 -1

这是我在谷歌上找到的;-)

jquery 缩放效果插件