Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/85.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 滑块内的动态图像_Javascript_Jquery_Html_Css - Fatal编程技术网

Javascript 滑块内的动态图像

Javascript 滑块内的动态图像,javascript,jquery,html,css,Javascript,Jquery,Html,Css,我有两个div类“container”和“inner”,inner显示/隐藏从div底部向上滑动的单个图像。当我试图让“inner”div显示来自if语句的图像而不是css中标识的图像时,就会出现问题。有人能告诉我我的代码哪里错了吗 <style> body {margin-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px;} .swipe {overflow: hidden; visibility:

我有两个div类“container”和“inner”,inner显示/隐藏从div底部向上滑动的单个图像。当我试图让“inner”div显示来自if语句的图像而不是css中标识的图像时,就会出现问题。有人能告诉我我的代码哪里错了吗

<style>
body {margin-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px;}
.swipe {overflow: hidden; visibility: hidden; position: relative;}
.swipe-wrap {overflow: hidden; position: relative;}
.swipe-wrap > div {float:left; width:100%; position: relative;}
#mySwipe div b {display:block; margin:0px; margin-top:240px; background:url(""); height:1280px; width:720px;}

.container {bottom:106px ;display:none ;position:absolute;}
.inner {background_image:url(); height:440px; width:800px;}

.brand1{background-image:url(apple_name.png); background-repeat:no-repeat; height:360px; width:360px;} 
.brand2{background-image:url(windows_name.png); background-repeat:no-repeat; height:360px; width:360px;} 
.brand3{background-image:url(android_name.png); background-repeat:no-repeat; height:360px; width:360px;} 
</style>


<script>
        function change(v) {
    var target = document.getElementById("mySwipe");

         if (v == "imgA") {target.className = "brand1";}
    else if (v == "imgB") {target.className = "brand2";}
    else if (v == "imgC") {target.className = "brand3";}
    else {target.className = "inner";}
}

function changeReset() {
    var target = document.getElementById("container");
    target.className = "inner";
}
</script>

<div id='mySwipe' style='width:720px; height:981px; margin-top:55px;' class='swipe'>
  <div class='swipe-wrap'>
    <div><a id="imgB" href="#"><img src="apple.jpg" /></a></div>
    <div><a id="imgB" href="#"><img src="windows.jpg" /></a></div>
    <div><a id="imgC" href="#"><img src="android.jpg" /></a></div>
  </div>
</div>

<script>

// pure JS
var elem = document.getElementById('mySwipe');
window.mySwipe = Swipe(elem, {

});

</script>

<div class='container'>
<div class='inner'>
</div>
</div>

正文{页边距左侧:0px;页边距顶部:0px;页边距右侧:0px;页边距底部:0px;}
.swipe{溢出:隐藏;可见性:隐藏;位置:相对;}
.swipe wrap{溢出:隐藏;位置:相对;}
.swipe wrap>div{float:左;宽度:100%;位置:相对;}
#mysweep div b{显示:块;边距:0px;边距顶部:240px;背景:url(“”);高度:1280px;宽度:720px;}
.container{底部:106px;显示:无;位置:绝对;}
.inner{background_image:url();高度:440px;宽度:800px;}
.brand1{背景图像:url(apple_name.png);背景重复:无重复;高度:360px;宽度:360px;}
.brand2{背景图像:url(windows_name.png);背景重复:无重复;高度:360px;宽度:360px;}
.brand3{背景图像:url(android_name.png);背景重复:无重复;高度:360px;宽度:360px;}
功能改变(五){
var target=document.getElementById(“mysweep”);
如果(v==“imgA”){target.className=“brand1”}
else如果(v==“imgB”){target.className=“brand2”}
else如果(v==“imgC”){target.className=“brand3”}
else{target.className=“inner”;}
}
函数changeReset(){
var target=document.getElementById(“容器”);
target.className=“内部”;
}
//纯JS
var elem=document.getElementById('mysweep');
window.myswip=滑动(元素{
});

这是一把小提琴:

来自的小提琴将有助于澄清您的问题,越来越多的人可能会帮助您。@JofryHS这是一个小提琴链接。注意,刷卡技工不是在台式机上工作,而是在安卓和其他手机上工作。我再次尝试使change()工作,以便在图像滑动时,调用时显示正确的目标。