gpt4 book ai didi

jquery - 仅对特定的 div 使用缩放

转载 作者:行者123 更新时间:2023-11-28 04:54:39 27 4
gpt4 key购买 nike

我们有一个座位计划,当在手机上时,只有在 setaplan 上有缩放功能会很方便。当您在 Andoid 移动设备上使用捏合放大时,它会放大,但您必须完全张开以保持页面的响应式外观。

这是我希望放大的 #seats div 的示例 https://jsfiddle.net/ohaumyxj/

这是可以用纯 CSS 实现的东西还是 jQuery 在这里混用?我正在寻找您在网站的联系页面上使用 Google map 获得的东西类型,或者使用点按缩放功能可能会更好一些。

.container {
margin: 0 auto;
}
#bmessage {
padding: 1px 3px;
height: 20px;
font-size: 14px;
background: #ddf;
color: #080;
font-weight: bold;
}
#seats:before {
content: '';
display: block;
padding: 50%;
}
#seats {
margin: 10px 0;
padding: 10px 0;
position: relative;
background-image: url(https://s21.postimg.org/qd8mqgh07/seatplan11.gif);
background-repeat: no-repeat;
background-size: contain;
}
#seats div {
position: absolute;
width: 1.5%;
height: 1.5%;
}
#seats .green {
background: url('https://s12.postimg.org/93ugmrvb1/seatg.gif') no-repeat center;
background-size: cover;
margin:0 !important;
}
<div id="theatre">
<div class="container">
<div id="bmessage">Select the seats that you need.</div>
<div id="seats">
<div class="avail std green" si="332" title="Y1" style="top: 8.7%; left: 10.2%; border: none; margin: 3px 1px;"></div>
<div class="avail std green" si="333" title="Y2" style="top:8.7%; left:13%;"></div>
<div class="avail std green" si="334" title="Y3" style="top:8.7%; left:16.2%;"></div>
<div class="avail std green" si="335" title="Y4" style="top: 8.7%; left: 18.8%; border: none; margin: 3px 1px;"></div>
<div class="avail std green" si="336" title="Y5" style="top: 8.7%; left: 21.5%; border: none; margin: 3px 1px;"></div>
<div class="avail std green" si="337" title="Y6" style="top:8.7%; left:24.2%;"></div>
</div>
</div>
</div>

最佳答案

像这样?

var zoomable = document.getElementById('seats'),
zX = 1;
window.addEventListener('wheel', function (e) {
var dir;
if (!e.ctrlKey) {
return;
}
dir = (e.deltaY > 0) ? 0.1 : -0.1;
zX += dir;
zoomable.style.transform = 'scale(' + zX + ')';
e.preventDefault();
return;
});

关于jquery - 仅对特定的 div 使用缩放,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40483399/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com