最近博客有需求。 在文章页面上,您需要单击以放大文章中的图片,然后再次单击以缩小。 写完后特别分享。
源代码:
```````
content='width=device-width,initial-scale=1.0,minimum-scale=1.0,maximum-scale=1.0,user-scalable=
蒲公英云. imgViewDom {
显示: none;
}
. disnone{
background:rgba65255、255、255和0.8;
定位:固定;
top: 0;
left: 0;
height: 100%;
width: 100%;
z-index: 99999999;
overflow :自动;
display: -webkit-box;
-WebKit-Box-Align:中心;
-WebKit-box-pack:中心;
display: -moz-box;
-moz-box-align:中心;
-moz-box-pack:中心;
display :-o盒;
-o-box-align:中心;
-o-box-pack:中心;
display: -ms-box;
-ms-box-align:中心;
-ms-box-pack:中心;
display :盒;
盒装:中心;
盒包:中心;
}
$ (document.ready (function ) )。
$ '.imgviewdom 2img '.click (function ) ) ) )。
letimagesrc=$(this ).attr ) (src );
letjquery=$(.imgviewdom ) ).attr ) ) src );
console.log(imagesrc;
if (jquery==空值) {
$('.imgViewDom img ' ).attr('src ',imageSrc );
$('.imgViewDom ' ).attr('class ',' imgViewDom disnone ' );
} else {
$('.imgViewDom ' ).attr('class ',' imgViewDom ' );
}
);
$ '.imgviewdomimg '.click (function ) ) ) ) ) ) )。
$('.imgViewDom ' ).attr('class ',' imgViewDom ' );
);
);
```````
效果演示我们还在使用车站内的: https://dandelion cloud.cn/tool/code demo
放入代码,然后单击调试预览
! [ () )/images/2021 05 21/1621591450631.png ]
! [ ] (/images/2021 05 21/1621591505253.png ) ) ) ) ) )。
! [ ] (/images/2021 05 21/1621591515022.png ) () ) ) ) )。
单击图像预览,然后单击“上一步”。 完成。