本帖最后由 starrycheng 于 2015-7-10 16:19 编辑
有没有JS属性可以设置,控制边框的显示? 先看图片:
“prevButton”和“nextButton”实际上是悬浮在了“Wrapper”上,而没有显示在间距 的里面。怎么样才可以让container和wrapper之间的左右间距显示出来, 然后按钮在间距的里面???而不是按钮直接悬浮在wrapper上,悬浮在 “swiper-slide”元素上。 有没有JS属性可以设置,控制边框的显示?
我尝试设置过margin-right属性,但是它不起作用。 margin-left是有作用的。 图片如下:
[size=14.3999996185303px]The HTML Code: - <div class="nav-swipper swiper-container swiper-container-horizontal">
- <div class="swiper-wrapper">
- <div class="swiper-slide"><span class="now"><b>你猜</b>测试</span></div>
- <div class="swiper-slide"><span><b>你猜</b>测试</span></div>
- <div class="swiper-slide"><span><b>你猜</b>测试</span></div>
- <div class="swiper-slide"><span><b>你猜</b>测试</span></div>
- <div class="swiper-slide"><span><b>你猜</b>测试</span></div>
- <div class="swiper-slide"><span><b>再猜</b>测试</span></div>
- </div>
- <!-- Add Pagination -->
- <!-- <div class="swiper-pagination"></div> -->
- <div class="swiper-button-next"></div>
- <div class="swiper-button-prev"></div>
- </div>
复制代码
CSS 代码:
- .nav-swipper{background: #F2F2F2;height: 78px;box-sizing: border-box; border-top: 1px solid #979797;}
- <font color="#ff0000">.nav-swipper .swiper-wrapper{margin: 0px 24px;}</font>
- .nav-swipper .swiper-slide {margin: 0px;text-align: center; font-size: 13px;color: #999; background: #F2F2F2; display: -webkit-box; display: -ms-flexbox; display: -webkit-flex; display: flex; -webkit-box-pack: center; -ms-flex-pack: center; -webkit-justify-content: center; justify-content: center; -webkit-box-align: center; -ms-flex-align: center; -webkit-align-items: center; align-items: center; }
- .nav-swipper .swiper-button-prev{background-image:url(../images/swiper-pre.png);background-size: 12px auto;left: 2px;right: auto;width: 12px;height: 19px;}
- .nav-swipper .swiper-button-next{background-image:url(../images/swiper-next.png);background-size: 12px auto;left: auto;right: 2px;width: 12px;height: 19px;}
- .nav-swipper span { display: inline-block; vertical-align: top;height: 64px; }
- .nav-swipper b { height: 42px; display: table-cell; vertical-align: middle; width: 42px; text-align: center; background: #F7F7F7; border-radius: 50%; border: #fff 1px solid; color: #ccc; box-shadow: 0px 1px 3px #999; }
- .nav-swipper span.now b{border-color: #FF6602;}
复制代码
JS代码: - var swiper = new Swiper('.nav-swipper', {
- pagination: '.swiper-pagination',
- slidesPerView: 4,
- paginationClickable: true,
- spaceBetween: 0,
- nextButton: '.swiper-button-next',
- prevButton: '.swiper-button-prev',
- });
复制代码
- .nav-swipper .swiper-wrapper{margin: 0px 24px;}
Margin-right貌似是不起作用的。 有没有大神遇到过啊,
|