Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/75.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

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/assembly/5.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_Slider - Fatal编程技术网

Javascript 不在网站上工作

Javascript 不在网站上工作,javascript,jquery,html,css,slider,Javascript,Jquery,Html,Css,Slider,出于某种原因,我的网站上没有出现这种情况,只显示了li文本,它正在滑动,但没有出现滑块,只有文本 我已经包括了js文件以及css和标记,但不知怎么的,它没有显示完整的滑块 这是我的密码: HTML: 有人能检查我上面提供的链接并告诉我哪里出了问题吗 谢谢 似乎没有一个答案能解决问题,我想我必须找到一个新的滑块 感谢您的帮助您的代码很好。滑块已创建,但幻灯片在框外,溢出隐藏,因此您看不到它们。添加这个css .banner ul { margin: 0; padding: 0; } 你的代码很

出于某种原因,我的网站上没有出现这种情况,只显示了
li
文本,它正在滑动,但没有出现滑块,只有文本

我已经包括了
js
文件以及css和标记,但不知怎么的,它没有显示完整的滑块

这是我的密码:

HTML:

有人能检查我上面提供的链接并告诉我哪里出了问题吗

谢谢


似乎没有一个答案能解决问题,我想我必须找到一个新的滑块


感谢您的帮助

您的代码很好。滑块已创建,但幻灯片在框外,溢出隐藏,因此您看不到它们。添加这个css

.banner ul { margin: 0; padding: 0; }

你的代码很好。滑块已创建,但幻灯片在框外,溢出隐藏,因此您看不到它们。添加这个css

.banner ul { margin: 0; padding: 0; }

嘿,问题是容器的高度

由于高度较低,它无法显示溢出

所以我对你的代码做了一些小改动

它们是:

<! DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

<head>
<title>Webpage</title>
<style type = "text/css">
.banner { position: relative; overflow: auto; 
  background: #0f0; 
  min-height: 100px; }
.banner li { list-style: none; }
.banner ul li { float: left; }
</style>
<script src="http://code.jquery.com/jquery-latest.min.js"></script>

<script src="http://unslider.com/unslider.min.js"></script>

<script>
$(document).ready(function(){
$(function() {
$('.banner').unslider();
});
});
</script>

</head>


<body>
<br/>
<h1 style="font-family:verdana; font-size:50px; font-weigth:bold; font-style:italic;" align="center" >Logo</h1>

<div class="banner">
<ul>
<li>This is a slide.</li>
<li>This is another slide.</li>
<li>This is a final slide.</li>
</ul>
</div>


<div id = "footer">
    <div class = "container">
        <ul>
            <li><a href = "?">Terms of use</a></li>
            <li><a href = "?">Privacy</a></li>
            <li><a href = "?">Cookies</a></li>
            <li><a href = "?">Accessibility</a></li>
        </ul>
    </div>
</div>


</body>
</html> 

网页
.banner{位置:相对;溢出:自动;
背景:#0f0;
最小高度:100px;}
.banner li{列表样式:无;}
.banner ul li{浮动:左;}
$(文档).ready(函数(){
$(函数(){
$('.banner').unslider();
});
});

标志
  • 这是一张幻灯片
  • 这是另一张幻灯片
  • 这是最后一张幻灯片

这对我很有用

嘿,问题在于容器的高度

由于高度较低,它无法显示溢出

所以我对你的代码做了一些小改动

它们是:

<! DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

<head>
<title>Webpage</title>
<style type = "text/css">
.banner { position: relative; overflow: auto; 
  background: #0f0; 
  min-height: 100px; }
.banner li { list-style: none; }
.banner ul li { float: left; }
</style>
<script src="http://code.jquery.com/jquery-latest.min.js"></script>

<script src="http://unslider.com/unslider.min.js"></script>

<script>
$(document).ready(function(){
$(function() {
$('.banner').unslider();
});
});
</script>

</head>


<body>
<br/>
<h1 style="font-family:verdana; font-size:50px; font-weigth:bold; font-style:italic;" align="center" >Logo</h1>

<div class="banner">
<ul>
<li>This is a slide.</li>
<li>This is another slide.</li>
<li>This is a final slide.</li>
</ul>
</div>


<div id = "footer">
    <div class = "container">
        <ul>
            <li><a href = "?">Terms of use</a></li>
            <li><a href = "?">Privacy</a></li>
            <li><a href = "?">Cookies</a></li>
            <li><a href = "?">Accessibility</a></li>
        </ul>
    </div>
</div>


</body>
</html> 

网页
.banner{位置:相对;溢出:自动;
背景:#0f0;
最小高度:100px;}
.banner li{列表样式:无;}
.banner ul li{浮动:左;}
$(文档).ready(函数(){
$(函数(){
$('.banner').unslider();
});
});

标志
  • 这是一张幻灯片
  • 这是另一张幻灯片
  • 这是最后一张幻灯片

这对我很有用

您需要在javascript代码中指定dots:true,例如,应用它,您将看到它运行良好

这里有一个正在为您工作的JSFIDLE链接


例如,您需要在javascript代码中指定dots:true,应用它,您会发现它工作得很好

这里有一个正在为您工作的JSFIDLE链接


取消滑动从列表(
)中的第一个列表项(
  • )中拾取高度。因此,只需将高度添加到第一个元素,即可使其正常工作。

    Unslider从列表(
      )的第一个列表项(
    • )中选择高度。因此,要使其工作正常,只需将高度添加到第一个元素。

      查看我的unslider.com帮助文件:

              <!-- The HTML -->
      <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
      <html>
      
          <head>
          <title>Unslider.com example</title>
          <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
          <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js" type="text/javascript"></script> 
          <script src="http://unslider.com/unslider.min.js"type="text/javascript"></script>
      
              <!-- JavaScript -->
      
          <script type="text/javascript">
      
              $(function() {
                  $('.banner').unslider({
                      speed: 500,               //  The speed to animate each slide (in milliseconds)
                      delay: 3000,              //  The delay between slide animations (in milliseconds)
                      complete: function() {},  //  A function that gets called after every slide animation
                      keys: true,               //  Enable keyboard (left, right) arrow shortcuts
                      dots: true,               //  Display dot navigation
                      fluid: false              //  Support responsive design. May break non-responsive designs
                  });
      
                  var unslider = $('.banner').unslider();
      
                  $('.prev').click(function() {
                      unslider.data('unslider').prev();
                  });
      
                  $('.next').click(function() {
                      unslider.data('unslider').next();
                  });
      
                  return false;
              });
          </script>
      
          <!-- CSS -->
          <style type="text/css">
      
              * { 
                  margin: 0;
                  padding: 0;
                  -webkit-box-sizing: border-box; 
              }
      
              .banner {
                  position: relative;
                  width: 100%;
                  overflow: auto;
                  top: 50px;
                  /*z-index: -1;*/
      
                  font-size: 18px;
                  line-height: 24px;
                  text-align: center;
      
                  color: #FFFFFF;
                  text-shadow: 0 0 1px rgba(0,0,0,.05), 0 1px 2px rgba(0,0,0,.3);
      
                  background: #FFFFFF;
                  box-shadow: 0 1px 2px rgba(0,0,0,.25);
              }
              .banner ul {
                  list-style: none;
                  width: 300%;
              }
              .banner ul li {
                  display: block;
                  float: left;
      
                  min-height: 500px;
      
                  -o-background-size: 100% 100%;
                  -ms-background-size: 100% 100%;
                  -moz-background-size: 100% 100%;
                  -webkit-background-size: 100% 100%;
                  background-size: 100% 100%;
      
                  box-shadow: inset 0 -3px 6px rgba(0,0,0,.1);
              }
      
              .banner .inner {
                  padding: 360px 0 110px;
      
                  float: left;
                  vertical-align:-100px;
              }
      
              .banner h1, .banner h2 {
                  font-size: 40px;
                  line-height: 52px;
                  color: #fff;
              }
      
              .banner .btn {
                  display: inline-block;
                  margin: 25px 0 0;
                  padding: 9px 22px 7px;
                  clear: both;
      
                  color: #fff;
                  font-size: 12px;
                  font-weight: bold;
                  text-transform: uppercase;
                  text-decoration: none;
                  border : rgba(255, 255, 255, 0.4) solid 2px;
                  border-radius: 5px;
              }
              .banner .btn:hover {
                  background : rgba(255, 255, 255, 0.05);
              }
              .banner .btn:active {
                  -webkit-filter: drop-shadow(0 -1px 2px rgba(0,0,0,.5));
                  -moz-filter: drop-shadow(0 -1px 2px rgba(0,0,0,.5));
                  -ms-filter: drop-shadow(0 -1px 2px rgba(0,0,0,.5));
                  -o-filter: drop-shadow(0 -1px 2px rgba(0,0,0,.5));
                  filter: drop-shadow(0 -1px 2px rgba(0,0,0,.5));
              }
      
              .banner .btn, .banner .dot {
                  -webkit-filter: drop-shadow(0 1px 2px rgba(0,0,0,.3));
                  -moz-filter: drop-shadow(0 1px 2px rgba(0,0,0,.3));
                  -ms-filter: drop-shadow(0 1px 2px rgba(0,0,0,.3));
                  -o-filter: drop-shadow(0 1px 2px rgba(0,0,0,.3));
                  filter: drop-shadow(0 1px 2px rgba(0,0,0,.3));
              }
      
              .banner .dots {
                  position: absolute;
                  left: 0;
                  right: 0;
                  bottom: 20px;
                  width: 100%;
              }
              .banner .dots li {
                  display: inline-block;
      
                  width: 10px;
                  height: 10px;
                  line-height: 10px;
                  margin: 0 4px;
      
                  text-indent: -999em;
      
                  border: 2px solid #fff;
                  border-radius: 6px;
                  cursor: pointer;
                  opacity: .4;
      
                  -webkit-transition: background .5s, opacity .5s;
                  -moz-transition: background .5s, opacity .5s;
                  transition: background .5s, opacity .5s;
              }
              .banner .dots li.active {
                  background: #fff;
                  opacity: 1;
              }  
      
              .unslider-arrow {
                  font-family: Expressway;
                  font-size: 50px;
                  text-decoration: none;
                  color: #3d3d3d;
                  background: rgba(255,255,255,0.7);
                  padding: 0 20px 5px 20px;
              }
      
              .next {
                  position: absolute;
                  top: 65%;
                  right: 0  
              }
      
              .prev {
                  position: absolute;
                  top: 65%;
                  right: 90 /* change to left:0; if u wanna have arrow on left side */ 
              }
          </style>
          </head>
          <!-- Body of HTML document -->
      
          <body>
              <div class="slider">
              <div class="banner">
                <ul>
                <li style="background-image: url('http://lorempixel.com/1200/600/');">
                  <div class="inner">
                    <h1>Some h1 text</h1>
                    <p>smaller p text</p>
      
                      <a class="btn" href="http://www.yourlink.com">Hyperlink</a>
                  </div>
                </li>
      
                <li style="background-image: url('http://lorempixel.com/1200/600/');">
                  <div class="inner">
                    <h1>Some h1 text</h1>
                    <p>smaller p text</p>
      
                    <a class="btn" href="http://www.yourlink.com">Hyperlink</a>
                    </div>
                    </li>
      
                 <li style="background-image: url('http://lorempixel.com/1200/600/');">
                   <div class="inner">
                    <h1>Some h1 text</h1>
                    <p>smaller p text</p>
      
                    <a class="btn" href="http://www.yourlink.com">Hyperlink</a>
                    </div>
                </li>
      
                <li style="background-image: url('http://lorempixel.com/1200/600/');">
                <div class="inner">
                    <h1>Some h1 text</h1>
                    <p>smaller p text</p>
      
                    <a class="btn" href="http://www.yourlink.com">Hyperlink</a>
                  </div>
                </li>
            </ul>
      
      
              </div>
                <a href="#" class="unslider-arrow prev">&larr;</a>
                <a href="#" class="unslider-arrow next">&rarr;</a>
              </div>
         </body>  
      
      </html> 
      
      
      Unslider.com示例
      $(函数(){
      $('.banner').unslider({
      速度:500,//为每张幻灯片设置动画的速度(毫秒)
      延迟:3000,//幻灯片动画之间的延迟(毫秒)
      complete:function(){},//在每次幻灯片动画之后调用的函数
      按键:true,//启用键盘(左、右)箭头快捷键
      dots:true,//显示点导航
      流体:错误//支持响应性设计。可能会破坏非响应性设计
      });
      var unslider=$('.banner').unslider();
      $('.prev')。单击(函数(){
      unslider.data('unslider').prev();
      });
      $('.next')。单击(函数(){
      unslider.data('unslider').next();
      });
      返回false;
      });
      * { 
      保证金:0;
      填充:0;
      -webkit框大小:边框框;
      }
      .横幅{
      位置:相对位置;
      宽度:100%;
      溢出:自动;
      顶部:50px;
      /*z指数:-1*/
      字号:18px;
      线高:24px;
      文本对齐:居中;
      颜色:#FFFFFF;
      文本阴影:0.01×rgba(0,0,0,05),0.1×2PXRGBA(0,0,0,3);
      背景:#FFFFFF;
      盒影:0 1px2pRGBA(0,0,0,25);
      }
      班纳保险公司{
      列表样式:无;
      宽度:300%;
      }
      班纳乌尔·李先生{
      显示:块;
      浮动:左;
      最小高度:500px;
      -o-背景尺寸:100%100%;
      -ms背景尺寸:100%100%;
      -moz背景大小:100%100%;
      -webkit背景大小:100%100%;
      背景大小:100%100%;
      盒影:插入0-3px6pxRGBA(0,0,0,1);
      }
      .banner.内部{
      填充:360px 0 110px;
      浮动:左;
      垂直对齐:-100px;
      }
      .banner h1、.banner h2{
      字体大小:40px;
      线高:52px;
      颜色:#fff;
      }
      .banner.btn{
      显示:内联块;
      利润率:25px0;
      填充:9px22px7px;
      明确:两者皆有;
      颜色:#fff;
      字体大小:12px;
      字体大小:粗体;
      文本转换:大写;
      文字装饰:无;
      边框:rgba(255,255,255,0.4)实心2px;
      边界半径:5px;
      }
      .banner.btn:悬停{
      背景:rgba(255,255,255,0.05);
      }
      .banner.btn:活动{
      -webkit筛选器:放置阴影(0)-
      
              <!-- The HTML -->
      <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
      <html>
      
          <head>
          <title>Unslider.com example</title>
          <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
          <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js" type="text/javascript"></script> 
          <script src="http://unslider.com/unslider.min.js"type="text/javascript"></script>
      
              <!-- JavaScript -->
      
          <script type="text/javascript">
      
              $(function() {
                  $('.banner').unslider({
                      speed: 500,               //  The speed to animate each slide (in milliseconds)
                      delay: 3000,              //  The delay between slide animations (in milliseconds)
                      complete: function() {},  //  A function that gets called after every slide animation
                      keys: true,               //  Enable keyboard (left, right) arrow shortcuts
                      dots: true,               //  Display dot navigation
                      fluid: false              //  Support responsive design. May break non-responsive designs
                  });
      
                  var unslider = $('.banner').unslider();
      
                  $('.prev').click(function() {
                      unslider.data('unslider').prev();
                  });
      
                  $('.next').click(function() {
                      unslider.data('unslider').next();
                  });
      
                  return false;
              });
          </script>
      
          <!-- CSS -->
          <style type="text/css">
      
              * { 
                  margin: 0;
                  padding: 0;
                  -webkit-box-sizing: border-box; 
              }
      
              .banner {
                  position: relative;
                  width: 100%;
                  overflow: auto;
                  top: 50px;
                  /*z-index: -1;*/
      
                  font-size: 18px;
                  line-height: 24px;
                  text-align: center;
      
                  color: #FFFFFF;
                  text-shadow: 0 0 1px rgba(0,0,0,.05), 0 1px 2px rgba(0,0,0,.3);
      
                  background: #FFFFFF;
                  box-shadow: 0 1px 2px rgba(0,0,0,.25);
              }
              .banner ul {
                  list-style: none;
                  width: 300%;
              }
              .banner ul li {
                  display: block;
                  float: left;
      
                  min-height: 500px;
      
                  -o-background-size: 100% 100%;
                  -ms-background-size: 100% 100%;
                  -moz-background-size: 100% 100%;
                  -webkit-background-size: 100% 100%;
                  background-size: 100% 100%;
      
                  box-shadow: inset 0 -3px 6px rgba(0,0,0,.1);
              }
      
              .banner .inner {
                  padding: 360px 0 110px;
      
                  float: left;
                  vertical-align:-100px;
              }
      
              .banner h1, .banner h2 {
                  font-size: 40px;
                  line-height: 52px;
                  color: #fff;
              }
      
              .banner .btn {
                  display: inline-block;
                  margin: 25px 0 0;
                  padding: 9px 22px 7px;
                  clear: both;
      
                  color: #fff;
                  font-size: 12px;
                  font-weight: bold;
                  text-transform: uppercase;
                  text-decoration: none;
                  border : rgba(255, 255, 255, 0.4) solid 2px;
                  border-radius: 5px;
              }
              .banner .btn:hover {
                  background : rgba(255, 255, 255, 0.05);
              }
              .banner .btn:active {
                  -webkit-filter: drop-shadow(0 -1px 2px rgba(0,0,0,.5));
                  -moz-filter: drop-shadow(0 -1px 2px rgba(0,0,0,.5));
                  -ms-filter: drop-shadow(0 -1px 2px rgba(0,0,0,.5));
                  -o-filter: drop-shadow(0 -1px 2px rgba(0,0,0,.5));
                  filter: drop-shadow(0 -1px 2px rgba(0,0,0,.5));
              }
      
              .banner .btn, .banner .dot {
                  -webkit-filter: drop-shadow(0 1px 2px rgba(0,0,0,.3));
                  -moz-filter: drop-shadow(0 1px 2px rgba(0,0,0,.3));
                  -ms-filter: drop-shadow(0 1px 2px rgba(0,0,0,.3));
                  -o-filter: drop-shadow(0 1px 2px rgba(0,0,0,.3));
                  filter: drop-shadow(0 1px 2px rgba(0,0,0,.3));
              }
      
              .banner .dots {
                  position: absolute;
                  left: 0;
                  right: 0;
                  bottom: 20px;
                  width: 100%;
              }
              .banner .dots li {
                  display: inline-block;
      
                  width: 10px;
                  height: 10px;
                  line-height: 10px;
                  margin: 0 4px;
      
                  text-indent: -999em;
      
                  border: 2px solid #fff;
                  border-radius: 6px;
                  cursor: pointer;
                  opacity: .4;
      
                  -webkit-transition: background .5s, opacity .5s;
                  -moz-transition: background .5s, opacity .5s;
                  transition: background .5s, opacity .5s;
              }
              .banner .dots li.active {
                  background: #fff;
                  opacity: 1;
              }  
      
              .unslider-arrow {
                  font-family: Expressway;
                  font-size: 50px;
                  text-decoration: none;
                  color: #3d3d3d;
                  background: rgba(255,255,255,0.7);
                  padding: 0 20px 5px 20px;
              }
      
              .next {
                  position: absolute;
                  top: 65%;
                  right: 0  
              }
      
              .prev {
                  position: absolute;
                  top: 65%;
                  right: 90 /* change to left:0; if u wanna have arrow on left side */ 
              }
          </style>
          </head>
          <!-- Body of HTML document -->
      
          <body>
              <div class="slider">
              <div class="banner">
                <ul>
                <li style="background-image: url('http://lorempixel.com/1200/600/');">
                  <div class="inner">
                    <h1>Some h1 text</h1>
                    <p>smaller p text</p>
      
                      <a class="btn" href="http://www.yourlink.com">Hyperlink</a>
                  </div>
                </li>
      
                <li style="background-image: url('http://lorempixel.com/1200/600/');">
                  <div class="inner">
                    <h1>Some h1 text</h1>
                    <p>smaller p text</p>
      
                    <a class="btn" href="http://www.yourlink.com">Hyperlink</a>
                    </div>
                    </li>
      
                 <li style="background-image: url('http://lorempixel.com/1200/600/');">
                   <div class="inner">
                    <h1>Some h1 text</h1>
                    <p>smaller p text</p>
      
                    <a class="btn" href="http://www.yourlink.com">Hyperlink</a>
                    </div>
                </li>
      
                <li style="background-image: url('http://lorempixel.com/1200/600/');">
                <div class="inner">
                    <h1>Some h1 text</h1>
                    <p>smaller p text</p>
      
                    <a class="btn" href="http://www.yourlink.com">Hyperlink</a>
                  </div>
                </li>
            </ul>
      
      
              </div>
                <a href="#" class="unslider-arrow prev">&larr;</a>
                <a href="#" class="unslider-arrow next">&rarr;</a>
              </div>
         </body>  
      
      </html>