Javascript-使用“ ClassName”和“ nextElementSibling” javascripts属性定位以下元素

问题描述

我正在为我的网站制作图片库/作品集,我希望当用户单击图片时:以大尺寸显示图片。就像在Google图片上一样。

function zoom() {
  var zoom = document.getElementsByClassName("portfolio").nextElementSibling;
  zoom.style.display = "block";
}
<div class="photo portfolio p1" id="1" onclick="zoom()"></div>
 <div class="zoom" id="101"><img src="Contents/1.jpeg"></div>

我不想用ID定位DIV,因为我有很多图像,并且想雾化该过程...

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)