原生的Jquery dataTable沒(méi)有這個(gè)功能的支持哦,只能自己用js和css限定,非常復(fù)雜

創(chuàng)新互聯(lián)建站長(zhǎng)期為成百上千家客戶提供的網(wǎng)站建設(shè)服務(wù),團(tuán)隊(duì)從業(yè)經(jīng)驗(yàn)10年,關(guān)注不同地域、不同群體,并針對(duì)不同對(duì)象提供差異化的產(chǎn)品和服務(wù);打造開(kāi)放共贏平臺(tái),與合作伙伴共同營(yíng)造健康的互聯(lián)網(wǎng)生態(tài)環(huán)境。為杏花嶺企業(yè)提供專業(yè)的成都做網(wǎng)站、網(wǎng)站設(shè)計(jì),杏花嶺網(wǎng)站改版等技術(shù)服務(wù)。擁有十余年豐富建站經(jīng)驗(yàn)和眾多成功案例,為您定制開(kāi)發(fā)。
如果一定要實(shí)現(xiàn)這種效果,建議使用easyui,調(diào)用簡(jiǎn)單方面,而且一個(gè)參數(shù)即可支持【鎖定列的橫向滾動(dòng)】功能。
實(shí)例以及源代碼:
;tree.html#datagrid
第一個(gè)example就是你需要的【鎖定列的橫向滾動(dòng)】哦
jquery在scroll()事件里面,我想判斷當(dāng)前滾動(dòng)條橫向還縱向;
我開(kāi)始用全局變量記錄scrollTop的值來(lái)判斷的,如果前后值沒(méi)有變就是橫向滾動(dòng)了,
但是頁(yè)面里有多個(gè)滾動(dòng)條,就要多個(gè)全局變量來(lái)控制,該怎么判斷呢?
scroll jquery 區(qū)分橫向縱向滾動(dòng)條
解決方法:
each一次設(shè)置選擇器選中對(duì)象的scrollLeft/scrollTop就行了,然后綁定scroll事件,觸發(fā)的時(shí)候獲取scrollLeft/scrollTop和初始化的scrollLeft/scrollTop對(duì)比判斷是橫向還是縱向,同時(shí)更新對(duì)象存儲(chǔ)的scrollLeft/scrollTop
style
.c{height:120px;width:120px;overflow:auto;border:solid 1px black;margin-bottom:5px;}
/style
div class="c"111111111111111111br1111111111111111111br1111111111111111111br1111111111111111111br1111111111111111111br1111111111111111111br1111111111111111111/div
div class="c"111111111111111111br1111111111111111111br1111111111111111111br1111111111111111111br1111111111111111111br1111111111111111111br1111111111111111111/div
div class="c"111111111111111111br1111111111111111111br1111111111111111111br1111111111111111111br1111111111111111111br1111111111111111111br1111111111111111111/div
div class="c"111111111111111111br1111111111111111111br1111111111111111111br1111111111111111111br1111111111111111111br1111111111111111111br1111111111111111111/div
script src="/js/jquery.js"/script
script
$('div').each(function(){$(this).data('slt',{sl:this.scrollLeft,st:this.scrollTop});}).scroll(function(){
var sl=this.scrollLeft,st=this.scrollTop,d=$(this).data('slt');
if(sl!=d.sl)alert('橫向滾動(dòng)');
if(st!=d.st)alert('縱向滾動(dòng)');
$(this).data('slt',{sl:sl,st:st});///
})
/script
最近流行的 sogo云輸入法, QQ云輸入法,都用到了bookmarklet技術(shù)。
這篇文章主要介紹了jQuery中even選擇器的定義和用法,較為詳細(xì)的分析了event選擇器的語(yǔ)法結(jié)構(gòu)與具體用法,并以一個(gè)設(shè)置偶數(shù)行為藍(lán)色字體的例子總結(jié)了其用法與功能特點(diǎn),需要的朋友可以參考下
晚上有插件可以實(shí)現(xiàn)"jquery tab",但有點(diǎn)復(fù)雜了,我想寫(xiě)個(gè)最簡(jiǎn)單的,來(lái)實(shí)現(xiàn)"jquery tab"。而事實(shí)上確實(shí)很簡(jiǎn)練
這篇文章主要介紹了JQuery樣式操作、click事件以及索引值-選項(xiàng)卡應(yīng)用,結(jié)合實(shí)例形式分析了jQuery動(dòng)態(tài)修改css樣式、事件響應(yīng)以及選項(xiàng)卡相關(guān)操作技巧,需要的朋友可以參考下
jQuery在遵循W3C規(guī)范的情況下,對(duì)事件的常用屬性進(jìn)行了封裝,使得事件處理在各大瀏覽器下都可以正常的運(yùn)行而不需要進(jìn)行瀏覽器類型判斷
主要是為了往后的項(xiàng)目中方便實(shí)現(xiàn)這類型的功能,在之前做問(wèn)卷調(diào)查那個(gè)應(yīng)用中,就用到這個(gè)來(lái)顯示結(jié)果,但當(dāng)時(shí)開(kāi)發(fā)時(shí)并不用是插件的,一大堆代碼,看也煩,用起來(lái)很麻煩
jquery動(dòng)態(tài)添加option選項(xiàng),還有動(dòng)態(tài)刪除的方法,大家參考使用吧
qTip2是一個(gè)灰常強(qiáng)大且精致的jQuery提示信息插件,是qTip的第2版,也是一個(gè)全新的版本,提供了豐富的功能及漂亮的外觀,非常易于使用
ul綁定mousewheel鼠標(biāo)滾動(dòng)事件(火狐用DOMMouseScroll)
取消默認(rèn)動(dòng)作,event.preventDefault()(IE:window.event.returnValue=false),這樣滾輪滾動(dòng)后就不會(huì)滾動(dòng)頁(yè)面了。
根據(jù)滾輪滾動(dòng)的方向?qū)l內(nèi)容進(jìn)行控制,獲取滾輪方向用event.wheelDelta,大于0為向上滾,小于0向下滾(火狐event.detail,方向剛好相反,大于0向下),再更改ul的scrollLeft值即可以模擬滾輪滾動(dòng)效果了。
你好,修改成了每頁(yè)顯示6張圖片。 然后向右滾動(dòng)的按鈕事件改成點(diǎn)一次滾動(dòng)一張圖片的距離。
向左滾動(dòng)的你按照我那樣修改一下就可以了。。
html charset="utf-8"
style type="text/css"
* { margin:0; padding:0;}
body { font-size:12px;}
.box {height:66px; float:left; width:660px; overflow: hidden; position:relative; }
.box li { display:block; float:left; margin-left:5px; margin-right:5px; width:100px; height:70px;background:#BBB;font-size:50px;color:#ccc;line-height:66px;text-decoration:none;text-align:center; cursor:pointer;}
.box li:hover { color:#999; }
.box li.active { background-position:-174px 0; color:#555;cursor:default;}
a.prev, a.next {background:url() no-repeat 0 0; display:block;width:23px;height:43px; float:left; margin:15px 0 0 0; cursor:pointer;}
a.next { background-image:url()}
.scroll_list{ width:10000em; position:absolute; }
/style
!-- 引入jQuery --
script src="" type="text/javascript"/script
script type="text/javascript"
$(function(){
var page= 1;
var i = 6;//每版四個(gè)圖片
var click_time = 0; //用來(lái)控制page++
//向右滾動(dòng)
$(".next").click(function(){ //點(diǎn)擊事件
var v_wrap = $(this).parents(".scroll"); // 根據(jù)當(dāng)前點(diǎn)擊的元素獲取到父元素
var v_show = v_wrap.find(".scroll_list"); //找到視頻展示的區(qū)域
var v_cont = v_wrap.find(".box"); //找到視頻展示區(qū)域的外圍區(qū)域
var v_width = v_cont.width();
var len = v_show.find("li").length; //我的視頻圖片個(gè)數(shù)
var page_count = Math.ceil(len/i); //只要不是整數(shù),就往大的方向取最小的整數(shù)
var move_width = v_width/i; //移動(dòng)距離不是一個(gè)box的寬度了,一個(gè)box里顯示4個(gè)li,一次移動(dòng)一個(gè)li,所以移動(dòng)距離除以4
click_time ++; //點(diǎn)擊一次click_time++
if(!v_show.is(":animated")){
if(page == page_count){
v_show.animate({left:'0px'},"slow");
page =1;
}else{
v_show.animate({left:'-='+move_width},"slow"); //移動(dòng)距離進(jìn)行了修改
if(click_time == i){ //當(dāng)click_time等于每頁(yè)次數(shù)的時(shí)候 進(jìn)行page++
page++;
click_time = 0;
}
}
}
});
//向左滾動(dòng)
$(".prev").click(function(){ //點(diǎn)擊事件
var v_wrap = $(this).parents(".scroll"); // 根據(jù)當(dāng)前點(diǎn)擊的元素獲取到父元素
var v_show = v_wrap.find(".scroll_list"); //找到視頻展示的區(qū)域
var v_cont = v_wrap.find(".box"); //找到視頻展示區(qū)域的外圍區(qū)域
var v_width = v_cont.width();
var len = v_show.find("li").length; //我的視頻圖片個(gè)數(shù)
var page_count = Math.ceil(len/i); //只要不是整數(shù),就往大的方向取最小的整數(shù)
if(!v_show.is(":animated")){
if(page == 1){
v_show.animate({left:'-='+ v_width*(page_count-1)},"slow");
page =page_count;
}else{
v_show.animate({left:'+='+ v_width},"slow");
page--;
}
}
});
});
/script
/head
body
!-- 例子 --
div class="scroll" style="margin:0 auto;width:770px;"
!-- "prev page" link --
a class="prev" href="#"/a
div class="box"
div class="scroll_list"
ul
li1/li li2/li li3/li li4/li
li5/li li6/li li7/li li8/li
li9/li li10/li li11/li li12/li
li13/li li14/li li15/li li16/li
/ul
/div
/div
!-- "next page" link --
a class="next" href="#"/a
/div
/body
/html
!DOCTYPE?HTML
html
head
meta?charset=UTF-8?/
titleNothing/title
style?type="text/css"
/style
script
var?create?=?function?(x,?y,?text)
{
var?marquee?=?document.createElement?('marquee');
marquee.style.position?=?'absolute';
marquee.style.left?=?x?+?'px';
marquee.style.top?=?y?+?'px';
marquee.innerText?=?text;
document.body.appendChild?(marquee);
}
window.onload?=?function?()
{
create?(100,?100,?"Look?boddy,?U?got?work?harder?and?put?yourself?to?the?JavaScript,?once?U?learn?the?heart?of?the?JavaScript,?I?can?guarantee?U?win.");
}
/script
/head
body
/body
/html
!DOCTYPE?html?PUBLIC?"-//W3C//DTD?XHTML?1.1//EN"
""
html?xmlns=""?xml:lang="en"
head
meta?http-equiv="content-type"?content="text/html;?charset=utf-8"?/
titleImage?Gallery/title
script?type="text/javascript"?src="jquery.min.js"/script
script
//?JavaScript?Document
$(document).ready(function(e)?{
/***不需要自動(dòng)滾動(dòng),去掉即可***/
time?=?window.setInterval(function(){
$('.og_next').click();?
},5000);
/***不需要自動(dòng)滾動(dòng),去掉即可***/
linum?=?$('.mainlist?li').length;//圖片數(shù)量
w?=?linum?*?250;//ul寬度
$('.piclist').css('width',?w?+?'px');//ul寬度
$('.swaplist').html($('.mainlist').html());//復(fù)制內(nèi)容
$('.og_next').click(function(){
if($('.swaplist,.mainlist').is(':animated')){
$('.swaplist,.mainlist').stop(true,true);
}
if($('.mainlist?li').length4){//多于4張圖片
ml?=?parseInt($('.mainlist').css('left'));//默認(rèn)圖片ul位置
sl?=?parseInt($('.swaplist').css('left'));//交換圖片ul位置
if(ml=0??mlw*-1){//默認(rèn)圖片顯示時(shí)
$('.swaplist').css({left:?'1000px'});//交換圖片放在顯示區(qū)域右側(cè)
$('.mainlist').animate({left:?ml?-?1000?+?'px'},'slow');//默認(rèn)圖片滾動(dòng)????
if(ml==(w-1000)*-1){//默認(rèn)圖片最后一屏?xí)r
$('.swaplist').animate({left:?'0px'},'slow');//交換圖片滾動(dòng)
}
}else{//交換圖片顯示時(shí)
$('.mainlist').css({left:?'1000px'})//默認(rèn)圖片放在顯示區(qū)域右
$('.swaplist').animate({left:?sl?-?1000?+?'px'},'slow');//交換圖片滾動(dòng)
if(sl==(w-1000)*-1){//交換圖片最后一屏?xí)r
$('.mainlist').animate({left:?'0px'},'slow');//默認(rèn)圖片滾動(dòng)
}
}
}
})
$('.og_prev').click(function(){
if($('.swaplist,.mainlist').is(':animated')){
$('.swaplist,.mainlist').stop(true,true);
}
if($('.mainlist?li').length4){
ml?=?parseInt($('.mainlist').css('left'));
sl?=?parseInt($('.swaplist').css('left'));
if(ml=0??mlw*-1){
$('.swaplist').css({left:?w?*?-1?+?'px'});
$('.mainlist').animate({left:?ml?+?1000?+?'px'},'slow');????
if(ml==0){
$('.swaplist').animate({left:?(w?-?1000)?*?-1?+?'px'},'slow');
}
}else{
$('.mainlist').css({left:?(w?-?1000)?*?-1?+?'px'});
$('.swaplist').animate({left:?sl?+?1000?+?'px'},'slow');
if(sl==0){
$('.mainlist').animate({left:?'0px'},'slow');
}
}
}
})????
});
$(document).ready(function(){
$('.og_prev,.og_next').hover(function(){
$(this).fadeTo('fast',1);
},function(){
$(this).fadeTo('fast',0.7);
})
})
/script
style
body,ul,li{?padding:0;?margin:0;}
ul,li{?list-style:none;}
img{?border:none;}
a{?color:#6cf;}
a:hover{?color:#84B263;}
.box{?width:980px;?margin:0?auto;?position:relative;?overflow:hidden;?_height:100%;}
.picbox{?width:980px;?height:115px;?overflow:hidden;?position:relative;}
.piclist{?height:115px;position:absolute;?left:0px;?top:0px}
.piclist?li{?background:#eee;?margin-right:20px;?padding:5px;?float:left;}
.swaplist{?position:absolute;?left:-3000px;?top:0px}
.og_prev,.og_next{?width:30px;?height:50px;?background:url(../images/icon.png)?no-repeat;?background:url(../images/icon_ie6.png)?no-repeat\9;?position:absolute;?top:33px;?z-index:99;?cursor:pointer;filter:alpha(opacity=70);?opacity:0.7;}
.og_prev{?background-position:0?-60px;?left:4px;}
.og_next{?background-position:0?0;?right:4px;}
/style
/head
body
div?class="box"
div?class="picbox"
ul?class="piclist?mainlist"
lia?href="#"?target="_blank"img?src="images/1.jpg"?width="220"?height="105"?//a/li
lia?href="#"?target="_blank"img?src="images/2.jpg"?width="220"?height="105"http://a/li
lia?href="#"?target="_blank"img?src="images/3.jpg"?width="220"?height="105"http://a/li
lia?href="#"?target="_blank"img?src="images/4.jpg"?width="220"?height="105"http://a/li
lia?href="#"?target="_blank"img?src="images/1.jpg"?width="220"?height="105"http://a/li
lia?href="#"?target="_blank"img?src="images/2.jpg"?width="220"?height="105"http://a/li
lia?href="#"?target="_blank"img?src="images/3.jpg"?width="220"?height="105"http://a/li
lia?href="#"?target="_blank"img?src="images/4.jpg"?width="220"?height="105"http://a/li
/ul
ul?class="piclist?swaplist"/ul
/div
div?class="og_prev"/div
div?class="og_next"/div
/div
/body
/html
文章標(biāo)題:jquery橫向滾動(dòng),jquery橫向滾動(dòng)原理
分享網(wǎng)址:http://chinadenli.net/article3/dsicsos.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供靜態(tài)網(wǎng)站、網(wǎng)站維護(hù)、關(guān)鍵詞優(yōu)化、動(dòng)態(tài)網(wǎng)站、網(wǎng)站建設(shè)、品牌網(wǎng)站建設(shè)
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來(lái)源: 創(chuàng)新互聯(lián)