jquery - 关闭按钮和动画效果随页面加载,而不是点击加载
问题描述
**关闭按钮加载页面而不是加载模式元素** 动画效果加载页面而不是加载图像,加载第一个效果而不选择图像
$(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">×</span>
<img id="expandedImg" class="popupimg_style ">
<div id="imgtext"></div>
</div>
解决方案
推荐阅读
- ruby-on-rails - RoR 简单友好的蛞蝓
- python - 如何从 scipy.spatial.Voronoi 获取边界会合点的坐标
- python - 将值插入到文本小部件中,删除以前的值 - Tkinter
- operating-system - 设备队列和等待队列有什么区别?
- javascript - 在 TestCafe 中使用 Selectors,需要抓取带有 id 和 class 的元素
- php - 在第 1 段纯 PHP 之后添加 AdSense 代码
- sequelize.js - Sequelize 在尝试插入外键时给出 500 错误
- java - Java 将 Array 集合排序为 String
- java - 在封闭函数中处理未处理的检查异常
- javascript - 非常奇怪的 jquery/asp.net webforms textarea 最大长度