?!DOCTYPE?html
創(chuàng)新互聯(lián)是由多位在大型網(wǎng)絡(luò)公司、廣告設(shè)計(jì)公司的優(yōu)秀設(shè)計(jì)人員和策劃人員組成的一個(gè)具有豐富經(jīng)驗(yàn)的團(tuán)隊(duì),其中包括網(wǎng)站策劃、網(wǎng)頁(yè)美工、網(wǎng)站程序員、網(wǎng)頁(yè)設(shè)計(jì)師、平面廣告設(shè)計(jì)師、網(wǎng)絡(luò)營(yíng)銷(xiāo)人員及形象策劃。承接:網(wǎng)站建設(shè)、成都網(wǎng)站設(shè)計(jì)、網(wǎng)站改版、網(wǎng)頁(yè)設(shè)計(jì)制作、網(wǎng)站建設(shè)與維護(hù)、網(wǎng)絡(luò)推廣、數(shù)據(jù)庫(kù)開(kāi)發(fā),以高性?xún)r(jià)比制作企業(yè)網(wǎng)站、行業(yè)門(mén)戶(hù)平臺(tái)等全方位的服務(wù)。
html?lang="en"
head
meta?charset="UTF-8"
link?rel="stylesheet"?href=""
style
.swiper-wrapper?{
height:?300px;
}
.swiper-slide?{
display:?flex;
justify-content:?center;
align-items:?center;
}
.swiper-slide:nth-child(1)?{
background:?red;
}
.swiper-slide:nth-child(2)?{
background:?green;
}
.swiper-slide:nth-child(3)?{
background:?blue;
}
/style
/head
body
div?class="swiper-container"
div?class="swiper-wrapper"
div?class="swiper-slide"Slide?1/div
div?class="swiper-slide"Slide?2/div
div?class="swiper-slide"Slide?3/div
/div
/div
/body
script?src=""/script
script?language="javascript"
var?mySwiper?=?new?Swiper(document.querySelector(".swiper-container"),?{
autoplay:?true,
})
document.querySelector('.swiper-container').onmouseover?=?()?=?{
mySwiper.autoplay.stop();
}
document.querySelector('.swiper-container').onmouseout?=?()?=?{
mySwiper.autoplay.start();
}
/script
/html
?請(qǐng)采納
!DOCTYPE?html
html
head
style
*{padding:0;margin:0;list-style:none;}
/style
script?src="
/head
body
a?href="#"第一條新聞/a
a?href="#"第二條新聞/a
a?href="#"第三條動(dòng)態(tài)/a
script
$(function(){
$('a:first').siblings().hide();
setInterval(function(){
$('a:visible').slideUp('slow',?function(){
$(this).next('a')[0]?===?undefined???$('a:first').fadeIn("slow")?:?$(this).next('a').fadeIn("slow");
});
},?1000*2)
});
/script
/body
/html
將javascript代碼替換為如下,
script type="text/javascript"jQuery(".scroolWarp").slide({ titCell:".hd ul", mainCell:".bd ul",effect:"left",vis:6,scroll:6,autoPlay:true,autoPage:true});/script
根據(jù)你的代碼 我改寫(xiě)了下 你看著弄吧。
!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" ""
html xmlns=""
head
meta http-equiv="Content-Type" content="text/html; charset=utf-8" /
title向左滾動(dòng)/title
style type="text/css"
*{
margin:0;
padding:0;
list-style:none;
}
#gundong {
background: #FFF;
overflow:hidden;
border: 1px dashed #CCC;
width: 500px;
font-size: 12px;
height: 20px;
line-height: 20px;
padding: 5px;
}
#gundong a {
color:#333;
}
#gundongAreaMain1 {
float: left;
width: 800%;
}
#gundongAreaMain2, #gundongAreaMain3, #gundongAreaMain2 li, #gundongAreaMain3 li {
float: left;
}
/style
/head
body
div id="gundongAreaMain"
span導(dǎo)讀/span
div id="gundong"
div id="gundongAreaMain1"
ul id="gundongAreaMain2"
lia href="/" target="_blank"strong1111111111111111/strong/a/li
lia href="/" target="_blank"strong2222222222222222/strong/a/li
lia href="/" target="_blank"strong3333333333333333/strong/a/li
lia href="/" target="_blank"strong4444444444444444/strong/a/li
/ul
ul id="gundongAreaMain3"/ul
/div
/div
/div
script
!--
var speed=30; //數(shù)字越大速度越慢
var tab=document.getElementById("gundong");
var tab1=document.getElementById("gundongAreaMain2");
var tab2=document.getElementById("gundongAreaMain3");
tab2.innerHTML=tab1.innerHTML;
function Marquee(){
if(tab2.offsetWidth-tab.scrollLeft=0)
tab.scrollLeft-=tab1.offsetWidth
else{
tab.scrollLeft++;
}
}
var MyMar=setInterval(Marquee,speed);
tab.onmouseover=function() {clearInterval(MyMar)};
tab.onmouseout=function() {MyMar=setInterval(Marquee,speed)};
--
/script
/body
/html
給你一個(gè)函數(shù)
你調(diào)用下就OK了,支持加速滾動(dòng)、循環(huán)滾動(dòng)、間隔滾動(dòng)、上下滾動(dòng)、左右滾動(dòng)等等
直接將這段代碼拷貝到一個(gè)JS文件里面,這段代碼需要jquery1.3以上運(yùn)行環(huán)境。
代碼里面有調(diào)用示例。
望采納··
/**
* @classDescription 超級(jí)Marquee,可做圖片導(dǎo)航,圖片輪換
* @dependence jQuery 1.3.2
* @DOM
* div id="marquee"
* ul
* li/li
* li/li
* /ul
* /div
* @CSS
* #marquee {width:200px;height:50px;overflow:hidden;}
* @Usage
* $('#marquee').superMarquee(options);
* @options
* distance:200,//一次滾動(dòng)的距離
* duration:20,//緩動(dòng)效果,單次移動(dòng)時(shí)間,越小速度越快,為0時(shí)無(wú)緩動(dòng)效果
* time:5,//停頓時(shí)間,單位為秒
* direction: 'left',//滾動(dòng)方向,'left','right','up','down'
* scrollAmount:1,//步長(zhǎng)
* scrollDelay:20//時(shí)長(zhǎng),單位為毫秒
* isEqual:true,//所有滾動(dòng)的元素長(zhǎng)寬是否相等,true,false
* loop: 0,//循環(huán)滾動(dòng)次數(shù),0時(shí)無(wú)限
* btnGo:{left:'#goL',right:'#goR'},//控制方向的按鈕ID,有四個(gè)屬性left,right,up,down分別對(duì)應(yīng)四個(gè)方向
* eventGo:'click',//鼠標(biāo)事件
* controlBtn:{left:'#goL',right:'#goR'},//控制加速滾動(dòng)的按鈕ID,有四個(gè)屬性left,right,up,down分別對(duì)應(yīng)四個(gè)方向
* newAmount:4,//加速滾動(dòng)的步長(zhǎng)
* eventA:'mouseenter',//鼠標(biāo)事件,加速
* eventB:'mouseleave',//鼠標(biāo)事件,原速
* navId:'#marqueeNav', //導(dǎo)航容器ID,導(dǎo)航DOM:ulli1/lili2/liul,導(dǎo)航CSS:.navOn
* eventNav:'click' //導(dǎo)航事件
*/
(function($){
$.fn.superMarquee = function(options){
var opts = $.extend({},$.fn.superMarquee.defaults, options);
return this.each(function(){
var $marquee = $(this);//滾動(dòng)元素容器
var _scrollObj = $marquee.get(0);//滾動(dòng)元素容器DOM
var scrollW = $marquee.width();//滾動(dòng)元素容器的寬度
var scrollH = $marquee.height();//滾動(dòng)元素容器的高度
var $element = $marquee.children(); //滾動(dòng)元素
var $kids = $element.children();//滾動(dòng)子元素
var scrollSize=0;//滾動(dòng)元素尺寸
var _type = (opts.direction == 'left' || opts.direction == 'right') ? 1:0;//滾動(dòng)類(lèi)型,1左右,0上下
var scrollId, rollId, isMove, marqueeId;
var t,b,c,d,e; //滾動(dòng)動(dòng)畫(huà)的參數(shù),t:當(dāng)前時(shí)間,b:開(kāi)始的位置,c:改變的位置,d:持續(xù)的時(shí)間,e:結(jié)束的位置
var _size, _len; //子元素的尺寸與個(gè)數(shù)
var $nav,$navBtns;
var arrPos = [];
var numView = 0; //當(dāng)前所看子元素
var numRoll=0; //輪換的次數(shù)
var numMoved = 0;//已經(jīng)移動(dòng)的距離
//防止?jié)L動(dòng)子元素比滾動(dòng)元素寬而取不到實(shí)際滾動(dòng)子元素寬度
$element.css(_type?'width':'height',10000);
//獲取滾動(dòng)元素的尺寸
var navHtml = 'ul';
if (opts.isEqual) {
_size = $kids[_type?'outerWidth':'outerHeight']();
_len = $kids.length;
scrollSize = _size * _len;
for(var i=0;i_len;i++){
arrPos.push(i*_size);
navHtml += 'li'+ (i+1) +'/li';
}
}else{
$kids.each(function(i){
arrPos.push(scrollSize);
scrollSize += $(this)[_type?'outerWidth':'outerHeight']();
navHtml += 'li'+ (i+1) +'/li';
});
}
navHtml += '/ul';
//滾動(dòng)元素總尺寸小于容器尺寸,不滾動(dòng)
if (scrollSize(_type?scrollW:scrollH)) return;
//克隆滾動(dòng)子元素將其插入到滾動(dòng)元素后,并設(shè)定滾動(dòng)元素寬度
$element.append($kids.clone()).css(_type?'width':'height',scrollSize*2);
//輪換導(dǎo)航
if (opts.navId) {
$nav = $(opts.navId).append(navHtml).hover( stop, start );
$navBtns = $('li', $nav);
$navBtns.each(function(i){
$(this).bind(opts.eventNav,function(){
if(isMove) return;
if(numView==i) return;
rollFunc(arrPos[i]);
$navBtns.eq(numView).removeClass('navOn');
numView = i;
$(this).addClass('navOn');
});
});
$navBtns.eq(numView).addClass('navOn');
}
//設(shè)定初始位置
if (opts.direction == 'right' || opts.direction == 'down') {
_scrollObj[_type?'scrollLeft':'scrollTop'] = scrollSize;
}else{
_scrollObj[_type?'scrollLeft':'scrollTop'] = 0;
}
if(opts.isMarquee){
//滾動(dòng)開(kāi)始
//marqueeId = setInterval(scrollFunc, opts.scrollDelay);
marqueeId = setTimeout(scrollFunc, opts.scrollDelay);
//鼠標(biāo)劃過(guò)停止?jié)L動(dòng)
$marquee.hover(
function(){
clearInterval(marqueeId);
},
function(){
//marqueeId = setInterval(scrollFunc, opts.scrollDelay);
clearInterval(marqueeId);
marqueeId = setTimeout(scrollFunc, opts.scrollDelay);
}
);
//控制加速運(yùn)動(dòng)
if(opts.controlBtn){
$.each(opts.controlBtn, function(i,val){
$(val).bind(opts.eventA,function(){
opts.direction = i;
opts.oldAmount = opts.scrollAmount;
opts.scrollAmount = opts.newAmount;
}).bind(opts.eventB,function(){
opts.scrollAmount = opts.oldAmount;
});
});
}
}else{
if(opts.isAuto){
//輪換開(kāi)始
start();
//鼠標(biāo)劃過(guò)停止輪換
$marquee.hover( stop, start );
}
//控制前后走
if(opts.btnGo){
$.each(opts.btnGo, function(i,val){
$(val).bind(opts.eventGo,function(){
if(isMove == true) return;
opts.direction = i;
rollFunc();
if (opts.isAuto) {
stop();
start();
}
});
});
}
}
function scrollFunc(){
var _dir = (opts.direction == 'left' || opts.direction == 'right') ? 'scrollLeft':'scrollTop';
if(opts.isMarquee){
if (opts.loop 0) {
numMoved+=opts.scrollAmount;
if(numMovedscrollSize*opts.loop){
_scrollObj[_dir] = 0;
return clearInterval(marqueeId);
}
}
var newPos = _scrollObj[_dir]+(opts.direction == 'left' || opts.direction == 'up'?1:-1)*opts.scrollAmount;
}else{
if(opts.duration){
if(t++d){
isMove = true;
var newPos = Math.ceil(easeOutQuad(t,b,c,d));
if(t==d){
newPos = e;
}
}else{
newPos = e;
clearInterval(scrollId);
isMove = false;
return;
}
}else{
var newPos = e;
clearInterval(scrollId);
}
}
if(opts.direction == 'left' || opts.direction == 'up'){
if(newPos=scrollSize){
newPos-=scrollSize;
}
}else{
if(newPos=0){
newPos+=scrollSize;
}
}
_scrollObj[_dir] = newPos;
if(opts.isMarquee){
marqueeId = setTimeout(scrollFunc, opts.scrollDelay);
}else if(td){
if(scrollId) clearTimeout(scrollId);
scrollId = setTimeout(scrollFunc, opts.scrollDelay);
}else{
isMove = false;
}
};
function rollFunc(pPos){
isMove = true;
var _dir = (opts.direction == 'left' || opts.direction == 'right') ? 'scrollLeft':'scrollTop';
var _neg = opts.direction == 'left' || opts.direction == 'up'?1:-1;
numRoll = numRoll +_neg;
//得到當(dāng)前所看元素序號(hào)并改變導(dǎo)航CSS
if(pPos == undefinedopts.navId){
$navBtns.eq(numView).removeClass('navOn');
numView +=_neg;
if(numView=_len){
numView = 0;
}else if(numView0){
numView = _len-1;
}
$navBtns.eq(numView).addClass('navOn');
numRoll = numView;
}
var _temp = numRoll0?scrollSize:0;
t=0;
b=_scrollObj[_dir];
//c=(pPos != undefined)?pPos:_neg*opts.distance;
e=(pPos != undefined)?pPos:_temp+(opts.distance*numRoll)%scrollSize;
if(_neg==1){
if(eb){
c = e-b;
}else{
c = e+scrollSize -b;
}
}else{
if(eb){
c =e-scrollSize-b;
}else{
c = e-b;
}
}
d=opts.duration;
//scrollId = setInterval(scrollFunc, opts.scrollDelay);
if(scrollId) clearTimeout(scrollId);
scrollId = setTimeout(scrollFunc, opts.scrollDelay);
}
function start(){
rollId = setInterval(function(){
rollFunc();
}, opts.time*1000);
}
function stop(){
clearInterval(rollId);
}
function easeOutQuad(t,b,c,d){
return -c *(t/=d)*(t-2) + b;
}
function easeOutQuint(t,b,c,d){
return c*((t=t/d-1)*t*t*t*t + 1) + b;
}
});
};
$.fn.superMarquee.defaults = {
isMarquee:false,//是否為Marquee
isEqual:true,//所有滾動(dòng)的元素長(zhǎng)寬是否相等,true,false
loop: 0,//循環(huán)滾動(dòng)次數(shù),0時(shí)無(wú)限
newAmount:3,//加速滾動(dòng)的步長(zhǎng)
eventA:'mousedown',//鼠標(biāo)事件,加速
eventB:'mouseup',//鼠標(biāo)事件,原速
isAuto:true,//是否自動(dòng)輪換
time:5,//停頓時(shí)間,單位為秒
duration:50,//緩動(dòng)效果,單次移動(dòng)時(shí)間,越小速度越快,為0時(shí)無(wú)緩動(dòng)效果
eventGo:'click', //鼠標(biāo)事件,向前向后走
direction: 'left',//滾動(dòng)方向,'left','right','up','down'
scrollAmount:1,//步長(zhǎng)
scrollDelay:10,//時(shí)長(zhǎng)
eventNav:'click'//導(dǎo)航事件
};
$.fn.superMarquee.setDefaults = function(settings) {
$.extend( $.fn.superMarquee.defaults, settings );
};
})(jQuery);
當(dāng)Memcached接收到客戶(hù)端發(fā)送過(guò)來(lái)的數(shù)據(jù)時(shí)首先會(huì)根據(jù)收到數(shù)據(jù)的大小選擇一個(gè)最合適的Slab Class,然后通過(guò)查詢(xún)Memcached保存著的該Slab Class內(nèi)空閑Chunk的列表就可以找到一個(gè)可用于存儲(chǔ)數(shù)據(jù)的Chunk。