Jquery 当我在iframe中显示网站时,iframe滚动不';iphone不能用,但其他手机也能用?
我想在iphone上的my iframe中显示网站,但iframe滚动不起作用。 滚动显示,但不会上下滑动 我不明白为什么scroll在iphone上不起作用 我尝试了很多方法,但都没能解决这个问题,除了iphone手机,其他手机都能解决这个问题 你能帮我做这个吗 我的Html代码:Jquery 当我在iframe中显示网站时,iframe滚动不';iphone不能用,但其他手机也能用?,jquery,iphone,scroll,frontend,Jquery,Iphone,Scroll,Frontend,我想在iphone上的my iframe中显示网站,但iframe滚动不起作用。 滚动显示,但不会上下滑动 我不明白为什么scroll在iphone上不起作用 我尝试了很多方法,但都没能解决这个问题,除了iphone手机,其他手机都能解决这个问题 你能帮我做这个吗 我的Html代码: <html lang="tr"> <head> <meta charset="utf-8"> <meta name="viewport" content="
<html lang="tr">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<style>
.web-preview{
position:fixed;
width:100%;
height:100vh;
/*display:none;*/
background:white;
top:0;
left:0;
z-index:9999999999;
}
.web-preview .preview-bar{
background: #4ea6fb;
color: #fff;
position: fixed;
width: 100%;
z-index: 9;
box-shadow: 0 0 10px #000000ba;
top: 0;
height: 50px;
}
@media only screen and (max-width: 1023px) {
.web-preview .preview-bar a.desktop-view {
display: none;
}
}
@media only screen and (max-width: 767px) {
.web-preview .preview-bar a.tablet-view {
display: none;
}
}
@media only screen and (max-width: 500px) {
.web-preview .preview-bar a.mobile-view {
display: none;
}
}
.web-preview .preview-bar a{
cursor:pointer;
}
.web-preview .preview-bar i{
line-height: 50px;
padding: 0 20px;
font-size: 20px;
}
.web-preview .preview-bar a, .web-preview .preview-bar i{
color:#fff;
transition: none;
}
.web-preview .preview-bar a:hover, .web-preview .preview-bar i:hover{
color:#eee;
background:#2d75ba;
}
.web-preview .iframe-content{
position:fixed;
top:50%;
left:50%;
transform:translate(-50%,-50%);
border:2px solid #2d75ba;
overflow: hidden;
border-radius: 5px;
box-shadow: 0 0 10px #000000d6;
width:100%;
height:100vh;
max-width:100%;
max-height:100vh;
padding-top: 50px;
}
.web-preview .iframe-content.desktop-view{
width:100%;
height:100vh;
}
.web-preview .iframe-content.tablet-view{
width:768px !important;
height:95vh !important;
}
.web-preview .iframe-content.mobile-view{
width:400px !important;
height:95vh !important;
}
.web-preview .iframe-content iframe{
width:100% !important;
height:95vh !important;
overflow:auto !important;
-webkit-overflow-scrolling:touch !important;
}
.iframe-close{
float:right;
}
</style>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css">
</head>
<body>
<div class="web-preview">
<div class="preview-bar">
<div class="container-fluid view-buttons">
<a class="mobile-view" data-value="mobile-view"><i class="fa fa-mobile"></i></a>
<a class="tablet-view" data-value="tablet-view"><i class="fa fa-tablet"></i></a>
<a class="desktop-view" data-value="desktop-view"><i class="fa fa-desktop"></i></a>
<a class="iframe-close"><i class="fa fa-times"></i></a>
</div>
</div>
<div class="iframe-content" id="iframe-content">
<iframe src="{{$software->url}}" allowfullscreen></iframe>
</div>
</div>
<script
src="https://code.jquery.com/jquery-3.4.1.min.js"
integrity="sha256-CSXorXvZcTkaix6Yvo6HppcZGetbYMGWSFlBw8HfCJo="
crossorigin="anonymous"></script>
<script>
jQuery(".view-buttons a").click(function () {
var arr = ['mobile-view','tablet-view','desktop-view'];
var view = jQuery(this).attr("data-value");
jQuery.each(arr, function(i, v){
jQuery(".iframe-content").removeClass(v);
});
jQuery(".iframe-content").addClass(view);
})
jQuery(".iframe-toggle").click(function () {
jQuery("body").css({
"overflow":"hidden",
"-webkit-overflow-scrolling":"touch",
});
jQuery(".web-preview").css({"display":"block"});
})
jQuery(".iframe-close").click(function () {
window.history.back();
})
</script>
</body>
</html>
.网页预览{
位置:固定;
宽度:100%;
高度:100vh;
/*显示:无*/
背景:白色;
排名:0;
左:0;
z指数:99999999;
}
.web预览.预览栏{
背景#4ea6fb;
颜色:#fff;
位置:固定;
宽度:100%;
z指数:9;
盒影:0 10px#000000巴;
排名:0;
高度:50px;
}
@仅介质屏幕和(最大宽度:1023px){
.web预览.预览栏a.桌面视图{
显示:无;
}
}
@仅介质屏幕和(最大宽度:767px){
.web预览.预览栏a.tablet-view{
显示:无;
}
}
@仅介质屏幕和(最大宽度:500px){
.web预览.预览栏a.mobile-view{
显示:无;
}
}
.web预览。预览栏a{
光标:指针;
}
.web预览.预览栏i{
线高:50px;
填充:0 20px;
字体大小:20px;
}
.web预览.预览栏a、.web预览.预览栏i{
颜色:#fff;
过渡:无;
}
.web预览。预览栏a:悬停,.web预览。预览栏i:悬停{
颜色:#eee;
背景:2d75ba;
}
.web预览.iframe内容{
位置:固定;
最高:50%;
左:50%;
转换:翻译(-50%,-50%);
边框:2px实心#2d75ba;
溢出:隐藏;
边界半径:5px;
盒影:0 10px#000000d6;
宽度:100%;
高度:100vh;
最大宽度:100%;
最大高度:100vh;
填充顶部:50px;
}
.web预览.iframe-content.desktop-view{
宽度:100%;
高度:100vh;
}
.web预览.iframe-content.tablet-view{
宽度:768px!重要;
高度:95vh!重要;
}
.web预览.iframe-content.mobile-view{
宽度:400px!重要;
高度:95vh!重要;
}
.web预览.iframe内容iframe{
宽度:100%!重要;
高度:95vh!重要;
溢出:自动!重要;
-webkit溢出滚动:触摸!重要;
}
.iframe关闭{
浮动:对;
}
jQuery(“.view按钮a”)。单击(函数(){
var arr=['mobile-view','tablet-view','desktop-view'];
var view=jQuery(this).attr(“数据值”);
jQuery.each(arr,function(i,v){
jQuery(“.iframe内容”).removeClass(v);
});
jQuery(“.iframe内容”).addClass(视图);
})
jQuery(“.iframe切换”)。单击(函数(){
jQuery(“body”).css({
“溢出”:“隐藏”,
“-webkit溢出滚动”:“触摸”,
});
jQuery(“.web预览”).css({“display”:“block”});
})
jQuery(“.iframe close”)。单击(函数(){
window.history.back();
})