简体   繁体   English

如何更改JavaScript滑块的大小

[英]How do you change the size of a javascript slider

I have been trying to change the size of my content slider for the past 2 hours and still no luck. 在过去的2个小时里,我一直在尝试更改内容滑块的大小,但仍然没有运气。

So here is what i have at the top of my html document: 所以这是我在HTML文档顶部的内容:

<script>
    $(function() {
        $('#slides').slidesjs({
            width: 1500,
            height: 350,
            play: {
                active: true,
                auto: true,
                interval: 4000,
                swap: true
            }
        });
    });
</script> 

here is where i insert the image in html and the container: CSS: 这是我在html和容器中插入图像的位置:CSS:

.container {
    margin-top:0px;
    margin-left:250px;
    -webkit-filter: grayscale(100%);
    -webkit-transition: all 1s ease;
    -moz-transition: all 1s ease;
    -o-transition: all 1s ease;
    -ms-transition: all 1s ease;
    transition: all 1s ease;      
}
.container:hover{
    -webkit-filter: grayscale(0%);
}

Html: HTML:

<div class="container">
    <div id="slides" >      
        <a href="timetablenotts.html"><img src="img/timetableNotts.png" </a>
        <a href="timetablenotts.html"><img src="img/timetableNotts.png" </a>
    </div>
</div>

Increasing the width for some reason decreases the height and nothing is done to the width ! 由于某种原因增加宽度会降低高度,而宽度却无济于事! I'm very confused ! 我很困惑! please help, Thank you ! 请帮忙,谢谢!

You haven't closed your img tags. 您尚未关闭img标签。

    <a href="timetablenotts.html"><img src="img/timetableNotts.png" </a>

Should be: 应该:

    <a href="timetablenotts.html"><img src="img/timetableNotts.png" /></a>

This slider uses bootstrap and some media queries and working as responsive slider. 该滑块使用引导程序和某些媒体查询,并用作响应滑块。 this is a good feature. 这是一个好功能。 you will find full examples in this package 您将在此软件包中找到完整的示例

to change the size you need in addition to the slider configuration settings ... you need to change the .container in different media queries. 除了更改滑块配置设置外,还需要更改大小...您需要在其他媒体查询中更改.container。

For example in line 143 of the standard example you will find this size: 例如,在标准示例的第143行中,您将找到以下大小:

  .container {
    width: 1170px
  } 

you may change to: 您可以更改为:

  .container {
    width: 100%
  }

here is the whole sizes .. you will find inline within the HTML 这是整个大小..您会在HTML中找到内联

/* For tablets & smart phones */
@media (max-width: 767px) {
  body {
    padding-left: 20px;
    padding-right: 20px;
  }
  .container {
    width: auto
  }
}

/* For smartphones */
@media (max-width: 480px) {
  .container {
    width: auto
  }
}

/* For smaller displays like laptops */
@media (min-width: 768px) and (max-width: 979px) {
  .container {
    width: 724px
  }
}

/* For larger displays */
@media (min-width: 1200px) {
  .container {
    width: 100%
  }
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM