首页 > 解决方案 > 关闭按钮和动画效果随页面加载,而不是点击加载

问题描述

**关闭按钮加载页面而不是加载模式元素** 动画效果加载页面而不是加载图像,加载第一个效果而不选择图像

$(document).ready(function(){
  $('.button').on('click', function(){
    var target = $(this).attr('rel');
    $("."+target).show().siblings("div").hide();
  });
});

function myFunction(imgs) {
  var expandImg = document.getElementById("expandedImg");
  var imgText = document.getElementById("imgtext");
  expandImg.src = imgs.src;
  imgText.innerHTML = imgs.alt;
  expandImg.parentElement.style.display = "block";
}
.closebtn {
  color: white;
  float: right;
  font-size: 43px;
  font-weight: bold;
  position: relative;
  top: -78px;
  right: 219px;
  z-index: 1;
}

.pulse {
  animation: pulse 4s ;
  margin: 0 auto;
  display: table;
  animation-direction: alternate;
  -webkit-animation-name: pulse;
  animation-name: pulse;
}

@-webkit-keyframes pulse {
  0% {
    -webkit-transform: scale(1);
  }
  50% {
    -webkit-transform: scale(1.1);
  }
  100% {
    -webkit-transform: scale(1);
  }
}


**js script for the button and close , image  **
<div class="container pulse">
  <span onclick="this.parentElement.style.display='none'" class="closebtn">&times;</span>
  <img id="expandedImg" class="popupimg_style ">
  <div id="imgtext"></div>
</div>

标签: jqueryhtmlcss

解决方案


推荐阅读