Updated Demo : 任何帮助是极大的赞赏 !!
我开发了一个带有垂直缩略图的旋转木马/滑块,它的工作非常精细,但是我还需要显示幻灯片计数,每当用户滚动下一组计数时都必须更新。 就像yahoo.com滑块(https://www.yahoo.com/news/)with up&向下箭头。
html:
#featured {
width: 920px;
position: relative;
border: 1px solid #ccc;
height: 400px;
background: #fff;
margin:0 auto;
border-radius: 5px;
/*overflow: hidden;*/
}
#featured ul.ui-tabs-nav {
position: absolute;
top: 0;
right: 0;
list-style: none;
padding: 0;
margin: 0;
width: 300px;
height: 100%;
overflow-y: auto;
}
#featured ul.ui-tabs-nav li {
padding: 0;
font-size: 12px;
color: #666;
}
#featured ul.ui-tabs-nav li img {
float: left;
margin: 2px 5px;
background: #fff;
padding: 2px;
border: 1px solid #eee;
}
#featured ul.ui-tabs-nav li span {
font-size: 12px;
font-family: Verdana;
line-height: 18px;
padding: 10px;
bottom: 0;
position: absolute;
color:#fff;
background: rgba(255,255,255,0);
background: -moz-linear-gradient(top, rgba(255,255,255,0) 0%, rgba(0,0,0,0.5) 100%);
background: -webkit-gradient(left top, left bottom, color-stop(0%, rgba(255,255,255,0)), color-stop(100%, rgba(0,0,0,0.5)));
background: -webkit-linear-gradient(top, rgba(255,255,255,0) 0%, rgba(0,0,0,0.5) 100%);
background: -o-linear-gradient(top, rgba(255,255,255,0) 0%, rgba(0,0,0,0.5) 100%);
background: -ms-linear-gradient(top, rgba(255,255,255,0) 0%, rgba(0,0,0,0.5) 100%);
background: linear-gradient(to bottom, rgba(255,255,255,0) 0%, rgba(0,0,0,0.5) 100%);
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#ffffff', endColorstr='#000000', GradientType=0 );
width: 93%;
}
#featured li.ui-tabs-nav-item a {
display: block;
height: 90px;
color: #333;
background: #fff;
line-height: 20px;
text-decoration:none;
border-bottom: 1px solid #fff;
}
#featured li.ui-tabs-nav-item a:hover {
background: #f2f2f2;
}
#featured li.ui-tabs-selected {
background: url('images/selected-item.gif') top left no-repeat;
}
#featured ul.ui-tabs-nav li.ui-tabs-selected a {
background: #ccc;
}
#featured .ui-tabs-panel {
width: 620px;
/*height: 250px;*/
background: #999;
position: relative;
}
#featured .ui-tabs-panel img {
width:100%;
height:100%;
}
#featured .ui-tabs-panel .info {
position: absolute;
bottom:0;
left: 0;
height: 70px;
background: rgba(255,255,255,0);
background: -moz-linear-gradient(top, rgba(255,255,255,0) 0%, rgba(0,0,0,0.5) 100%);
background: -webkit-gradient(left top, left bottom, color-stop(0%, rgba(255,255,255,0)), color-stop(100%, rgba(0,0,0,0.5)));
background: -webkit-linear-gradient(top, rgba(255,255,255,0) 0%, rgba(0,0,0,0.5) 100%);
background: -o-linear-gradient(top, rgba(255,255,255,0) 0%, rgba(0,0,0,0.5) 100%);
background: -ms-linear-gradient(top, rgba(255,255,255,0) 0%, rgba(0,0,0,0.5) 100%);
background: linear-gradient(to bottom, rgba(255,255,255,0) 0%, rgba(0,0,0,0.5) 100%);
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#ffffff', endColorstr='#000000', GradientType=0 );
width:620px;
}
#featured .info h2 {
font-size: 18px;
font-family: Georgia, serif;
color: #fff;
padding: 5px;
margin: 0;
overflow: hidden;
}
#featured .info p {
margin: 0 5px;
font-family: Verdana;
font-size: 11px;
line-height: 15px;
color: #f0f0f0;
}
#featured .info a {
text-decoration: none;
color: #fff;
font-size: 18px;
font-family: arial;
}
#featured .info a:hover {
text-decoration: underline;
}
#featured .ui-tabs-hide {
display: none;
}
.ui-tabs-nav::-webkit-scrollbar-track {
-webkit-box-shadow: inset 0 0 6px rgba(0,0,0,0.3);
background-color: #F5F5F5;
}
.ui-tabs-nav::-webkit-scrollbar {
width: 6px;
background-color: #F5F5F5;
}
.ui-tabs-nav::-webkit-scrollbar-thumb {
background-color: #000000;
}
.show-for-small {
display:none !important;
}
.img-bg {
width: 100%;
height: 100%;
float: left;
}
/*slider count starts*/
.slide-counter {
position: absolute;
bottom: 0;
right: 0;
width: 280px;
background: #f00;
padding: 10px;
color: #fff;
}
.s-arrow {
float:right;
}
.up-arrow {
cursor: pointer;
}
.down-arrow {
cursor: pointer;
}
/*slider count ends*/
@media only screen and (min-width:300px) and (max-width:760px) {
#featured {
width: 300px;
border-radius: 0;
}
#featured .ui-tabs-panel {
width:300px;
height: 150px;
}
#featured ul.ui-tabs-nav {
position: relative;
height: auto;
overflow-y: auto;
}
#featured .ui-tabs-panel .info {
width:auto;
}
#featured li.ui-tabs-nav-item a {
height:auto;
background:#004990;
float:left;
width:100%;
}
#featured .info a {
font-size: 14px;
}
.hide-for-small {
display:none !important;
}
.show-for-small {
display:block !important;
}
.mob-img {
float:left;
width:100px;
}
#featured ul.ui-tabs-nav li span {
position: relative;
background: none;
float: left;
width: 170px;
}
}
css:
$("#featured > ul").tabs({fx:{opacity: "toggle"}})//.tabs("rotate", 5000, true);
var sliderNavLength = $('.ui-tabs-nav li').length;
$('.slide-counter').find('.s-counter').text("1 - " + sliderNavLength);
alert(" sliderNavLength - " + sliderNavLength);
JS:
(文档)$。就绪(函数(){
2017_03_27_121531_create_purchase_sold_returns_table.php
2017_03_27_121532_create_purchase_solds_table.php
2017_03_27_121533_create_purchases_table.php
2017_03_27_121534_create_purchase_returns_table.php
2017_03_27_121535_create_solds_table.php
});
答案 0 :(得分:1)
我做到了.. 这里是 demo
js:
$(document).ready(function(){
$("#featured").tabs({fx:{opacity: "toggle", duration: "fast"}});
var sliderNavLength = $('.ui-tabs-nav li').length;
var sliderNavUlHeight = $(".ui-tabs-nav")[0].scrollHeight;
var sliderNavLiHeight = 0;
$(".ui-tabs-nav li:lt(3)").each(function() {
sliderNavLiHeight += $(this).height();
});
var recCount = 3;
$('.ui-tabs-nav li:first-child()').addClass('firstChild');
$('.ui-tabs-nav li:last-child()').addClass('lastChild');
$('.slide-counter').find('.s-counter').text(" of " + sliderNavLength);
$('.up-arrow').click(function(e){
if (recCount > 3) {
var sliderScrollCountMinus = $('.ui-tabs-nav').scrollTop() - sliderNavLiHeight;
$('.ui-tabs-nav').animate({ scrollTop: sliderScrollCountMinus }, 1000);
$('.counter').val( parseInt($('.counter').val()) - 3 );
$('.counterSingle').val( parseInt($('.counterSingle').val()) - 3 );
recCount = recCount - 3;
}
});
$('.down-arrow').click(function(e){
if (sliderNavLength > recCount) {
var sliderScrollCountPlus = $('.ui-tabs-nav').scrollTop() + sliderNavLiHeight;
$('.ui-tabs-nav').animate({ scrollTop: sliderScrollCountPlus }, 1000);
$('.counter').val( parseInt($('.counter').val()) + 3 );
$('.counterSingle').val( parseInt($('.counterSingle').val()) + 3 );
recCount = recCount + 3;
}
});
});