简体   繁体   English

我尝试创建一个图像弹出窗口但在这里我的脚本严重失败任何人都可以帮助我

[英]I tried creating a image popup but failed badly here my script anyone can help me out

hello all I am working on image popup that appears after clicking on banner I tried some basic js concept but failed badly.大家好我正在处理点击横幅后出现的图像弹出窗口我尝试了一些基本的 js 概念但失败得很厉害。 looking forward HELP pps """期待帮助pps“”“

<!-- popup main -->
<div class="cover">
  <div class="contents">
    <img src="https://cdn.shopify.com/s/files/1/0605/0680/0349/files/PIGEON_a37dee29-65ce-4314-b624-e468c334fc9d.jpg?v=1664194339" alt="gh" width="100%" height="100%" />
    <a class="close" href="#">&times;</a>
  </div>
</div>
<button href="#popup_flight_travlDil3" onclick="show('cover')">kk</button>


<a class="close_flight_travelDl" href="#">&times;</a>

<script>
$(function(){
  $("button-link").click(function(){
    $(".cover").fadeIn("300");
  })
  $(".cover,.close").click(function(){
    $(".cover").fadeOut("300");
  })
  $(".contents").click(function(e){
    e.stopPropagation();
  })
})

</script>

<style> 
.cover {
  background: rgba(0, 0, 0, 0.7);
  position: fixed;
  display: none;
  opacity: 100;
  z-index: 5;
}
.contents {
  background: #fff;
  margin: 70px auto;
  border: 5px solid #ccc;
  border-radius: 30px;
  position: relative;
  z-index: 5;
  padding: 10px;
  width: 33%;
  height: 10%;
}
.close {
  position: absolute;
  top: 30px;
  right: 20px;
  transition: all 200ms;
  font-size: 95px;
  font-weight: bold;
  text-decoration: none;
  color: #000000;
}

</style>

""" """

LOOKING FOR SOLUTION THAT REPLACE BUTTON WITH THE A CLASS LINK OR ANYOTHER WAY ROUND寻找用 A CLASS 链接或任何其他方式替换按钮的解决方案

replacing button with an img tag and adding eventListener to open or close the popupimg标签替换按钮并添加 eventListener 以打开或关闭弹出窗口

 let btn = document.querySelector(".btn"); let cover = document.querySelector(".cover"); let closebtn = document.querySelector(".close"); btn.addEventListener("click", () => { cover.classList.toggle("active") }) closebtn.addEventListener("click", () => { cover.classList.remove("active") })
 .cover { background: rgba(0, 0, 0, 0.7); position: fixed; display: none; opacity: 100; margin-left: 100px; z-index: 5; }.cover.active { display: block; }.contents { background: #fff; margin: 70px auto; border: 5px solid #ccc; border-radius: 30px; position: relative; z-index: 5; padding: 10px; width: 33%; height: 10%; }.close { position: absolute; top: -10px; right: 10px; transition: all 200ms; font-size: 65px; font-weight: bold; text-decoration: none; color: #000000; background-color: transparent; border: none; }
 <:-- popup main --> <div class="cover"> <div class="contents"> <img src="https.//cdn.shopify.com/s/files/1/0605/0680/0349/files/PIGEON_a37dee29-65ce-4314-b624-e468c334fc9d?jpg;v=1664194339" alt="gh" width="100%" height="100%" /> <button class="close">&times:</button> </div> </div> <img class="btn" src="https.//images.unsplash?com/photo-1657299156538-e08595d224ca.ixlib=rb-1.2.1&ixid=MnwxMjA3fDF8MHxlZGl0b3JpYWwtZmVlZHwzMXx8fGVufDB8fHx8&auto=format&fit=crop&w=500&q=60" alt "">

暂无
暂无

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

相关问题 我创建了这个下拉框,但项目没有被选中。 我在这里留下我的代码,有人可以帮助我吗? - I created this dropdown box but the items are not getting selected. I am leaving my code here, can anyone help me out? 我如何 map 反应 js 中的一个数组我试过了但是有一些问题谁能帮我 - how do i map an array in react js i have tried but there is some problem can anyone help me 谁能帮我弄清楚为什么我无法让jQuery震动效果在我的div上起作用? - Can anyone help me in figuring out why I can't get Jquery shake effect to work on my div? 谁能帮我找出我的表单验证代码有什么问题? - Can anyone help me find out what's wrong with my form validation code? 地理定位脚本不起作用? 谁能帮助我我的代码有什么问题 - GeoLocation script not working ? can anyone help me what's wrong in my code 谁能指出我在这里的错误我找不到它 - Could anyone point to me the error here i can't find it 我卡在 firebase 云火库上的上传图像中。 谁能帮我。? - i m stuck in upload image on firebase cloud firestore. Can anyone help me .? 当我试图打开我的反应应用程序时,CMD 显示 npm 错误:说'npm err? 缺少脚本:开始'任何人都可以帮助我吗? - While i am trying to open my react app the CMD showing an npm err! Saying 'npm err! missing script:start' can anyone help me? 有人可以帮我解析嵌套JSON响应中元素的值。 我想在html页面上显示值或“ priceInCents”,这是我的脚本 - Can someone help me parse value of element from nested JSON response. I want to display value or “priceInCents” on html page here is my script 谁能帮我为我的数据表添加Javascript分页 - Can anyone help me add a Javascript pagination for my datatables
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM