欧美一区二区三区老妇人-欧美做爰猛烈大尺度电-99久久夜色精品国产亚洲a-亚洲福利视频一区二区

jquery點(diǎn)擊滾動,jquery滾動事件

jQuery實(shí)現(xiàn)將div中滾動條滾動到指定位置的方法

本文實(shí)例講述了jQuery實(shí)現(xiàn)將div中滾動條滾動到指定位置的方法。分享給大家供大家參考,具體如下:

站在用戶的角度思考問題,與客戶深入溝通,找到臺州網(wǎng)站設(shè)計(jì)與臺州網(wǎng)站推廣的解決方案,憑借多年的經(jīng)驗(yàn),讓設(shè)計(jì)與互聯(lián)網(wǎng)技術(shù)結(jié)合,創(chuàng)造個(gè)性化、用戶體驗(yàn)好的作品,建站類型包括:網(wǎng)站建設(shè)、網(wǎng)站設(shè)計(jì)、企業(yè)官網(wǎng)、英文網(wǎng)站、手機(jī)端網(wǎng)站、網(wǎng)站推廣、域名申請、虛擬空間、企業(yè)郵箱。業(yè)務(wù)覆蓋臺州地區(qū)。

一、Js代碼:

onload

=

function

()

{

//初始化

scrollToLocation();

};

function

scrollToLocation()

{

var

mainContainer

=

$('#thisMainPanel'),

scrollToContainer

=

mainContainer.find('.son-panel:last');//滾動到div

id="thisMainPanel"中類名為son-panel的最后一個(gè)div處

//scrollToContainer

=

mainContainer.find('.son-panel:eq(5)');//滾動到div

id="thisMainPanel"中類名為son-panel的第六個(gè)處

//非動畫效果

//mainContainer.scrollTop(

//

scrollToContainer.offset().top

-

mainContainer.offset().top

+

mainContainer.scrollTop()

//);

//動畫效果

mainContainer.animate({

scrollTop:

scrollToContainer.offset().top

-

mainContainer.offset().top

+

mainContainer.scrollTop()

},

2000);//2秒滑動到指定位置

}

二、Html代碼:

div

id="thisMainPanel"

style="height:200px;overflow-y:

scroll;border:1px

solid

#f3f3f3;"

div

class="son-panel"我是類容區(qū)域-1/div

div

class="son-panel"我是類容區(qū)域-2/div

div

class="son-panel"我是類容區(qū)域-3/div

div

class="son-panel"我是類容區(qū)域-4/div

div

class="son-panel"

style="height:160px;"我是類容區(qū)域-5/div

div

class="son-panel"我是類容區(qū)域-6/div

div

class="son-panel"我是類容區(qū)域-7/div

div

class="son-panel"我是類容區(qū)域-8/div

/div

更多關(guān)于jQuery相關(guān)內(nèi)容感興趣的讀者可查看本站專題:《jQuery常用插件及用法總結(jié)》、《jQuery常見經(jīng)典特效匯總》、《jQuery

form操作技巧匯總》、《jQuery操作json數(shù)據(jù)技巧匯總》、《jQuery擴(kuò)展技巧總結(jié)》、《jQuery拖拽特效與技巧總結(jié)》、《jQuery表格(table)操作技巧匯總》、《jquery中Ajax用法總結(jié)》、《jQuery動畫與特效用法總結(jié)》及《jquery選擇器用法總結(jié)》

希望本文所述對大家jQuery程序設(shè)計(jì)有所幫助。

jquery點(diǎn)擊按鈕圖片上下滾動怎么做?

!DOCTYPE html

html lange="en"

head

title點(diǎn)擊左右按鈕圖片橫向滾動/title

meta charset=utf-8" /

style type="text/css"

* { margin:0; padding:0;}

body { font-size:12px;}

.box {height:66px; float:left; width:440px; 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 = 4;//每版四個(gè)圖片

//向右滾動

$(".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ù)

if(!v_show.is(":animated")){

if(page == page_count){

v_show.animate({left:'0px'},"slow");

page =1;

}else{

v_show.animate({left:'-='+v_width},"slow");

page++;

}

}

});

//向左滾動

$(".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:550px;"

!-- "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

jquery怎么禁止手機(jī)頁面觸屏滑動頁面滾動

1、jquery 監(jiān)聽頁面滾動使用的方法:.scroll()。

2、新建一個(gè)HTML文檔,定義body的高度。

3、創(chuàng)建JS腳本,使用.scroll() 方法監(jiān)聽頁面滾動。

4、如果頁面發(fā)生滾動,則執(zhí)行函數(shù),彈出一個(gè)hello。

5、保存文件,查看.scroll()監(jiān)聽頁面滾動的效果。

jquery.nicescroll.min.js滾動條使用方法

(摘自博客園,原網(wǎng)址)

jquery.nicescroll.min.js滾動條使用方法,Nicescroll是制作自定義滾動條的jq插件。支持div,iframe,html等使用,兼容IE7-8,safari,firefox,webkit內(nèi)核瀏覽器(chrome,safari)以及智能終端設(shè)備瀏覽器的滾動條。

頁面使用:

$("html").niceScroll({

cursorcolor:"#E62020",

cursoropacitymax:1,

touchbehavior:false,

cursorwidth:"10px",

cursorborder:"0",

cursorborderradius:"5px"

})

nicescroll詳細(xì)參數(shù)配置:

cursorcolor - 設(shè)置滾動條顏色,默認(rèn)值是“#000000”

cursoropacitymin - 滾動條透明度最小值

cursoropacitymax - 滾動條透明度最大值

cursorwidth - 滾動條的寬度像素,默認(rèn)為5(你可以寫“5PX”)

cursorborder - CSS定義邊框,默認(rèn)為“1px solid #FFF”

cursorborderradius - 滾動條的邊框圓角

ZIndex的 - 改變滾動條的DIV的z-index值,默認(rèn)值是9999

scrollspeed - 滾動速度,默認(rèn)值是60

mousescrollstep - 滾動鼠標(biāo)滾輪的速度,默認(rèn)值是40(像素)

touchbehavior - 讓滾動條能拖動滾動觸摸設(shè)備默認(rèn)為false

hwacceleration - 使用硬件加速滾動支持時(shí),默認(rèn)為true

boxzoom - 使變焦框的內(nèi)容,默認(rèn)為false

dblclickzoom - (僅當(dāng)boxzoom = TRUE)變焦啟動時(shí),雙點(diǎn)擊框,默認(rèn)為true

gesturezoom - boxzoom = true并使用觸摸設(shè)備)變焦(僅當(dāng)激活時(shí),間距/盒,默認(rèn)為true

grabcursorenabled“搶”圖標(biāo),顯示div的touchbehavior = true時(shí),默認(rèn)值是true

autohidemode,如何隱藏滾動條的作品,真正的默認(rèn)/“光標(biāo)”=只光標(biāo)隱藏/ FALSE =不隱藏

的背景下,改變鐵路背景的CSS,默認(rèn)值為“”

iframeautoresize中,AUTORESIZE iframe上的load事件(默認(rèn):true)

cursorminheight,設(shè)置最低滾動條高度(默認(rèn)值:20)

preservenativescrolling,您可以用鼠標(biāo)滾動本地滾動的區(qū)域,鼓泡鼠標(biāo)滾輪事件(默認(rèn):true)

railoffset,您可以添加抵消頂部/左軌位置(默認(rèn):false)

bouncescroll,使?jié)L動反彈結(jié)束時(shí)的內(nèi)容移動(僅硬件ACCELL)(默認(rèn):FALSE)

spacebarenabled,允許使用空格鍵滾動(默認(rèn):true)

railpadding,設(shè)置間距(默認(rèn):頂:0,右:0,左:0,底部:0})

disableoutline,Chrome瀏覽器,禁用綱要(橙色hightlight)時(shí),選擇一個(gè)div nicescroll(默認(rèn):true)

求助 jquery點(diǎn)擊只能滾動一次??

你好,你需要先明確一個(gè)問題,當(dāng)執(zhí)行jQuery的animate方法的時(shí)候,是指從元素當(dāng)前狀態(tài)平滑過渡到指定狀態(tài)。

當(dāng)你第一次點(diǎn)擊的時(shí)候,當(dāng)前狀態(tài)是 ?top = 0 ?所以,.page元素的 top 會從 0 變化為 -200px

而當(dāng)你再次點(diǎn)擊時(shí),當(dāng)前狀態(tài)的 ?top = -200px ?了,.page元素的 top 從 -200px 變化為 -200px 自然是沒反應(yīng)的。

如果你是想實(shí)現(xiàn)每點(diǎn)一次,.page 元素的 top 值都減小 200px,那么可以這么寫:

$(".down").click(function()?{

var?page?=?$('.page'),

top?=?parseInt(page.css('top'));

top?=?isNaN(top)???-200?:?top?-?200;??????????????

$(".page").stop().animate({top:?top?+?'px'},?800,?'easeInOutExpo');

});

希望能幫你解決問題,如有疑問歡迎追問,望采納~~

新聞標(biāo)題:jquery點(diǎn)擊滾動,jquery滾動事件
分享鏈接:http://chinadenli.net/article12/dsdicdc.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供ChatGPT、網(wǎng)站營銷App開發(fā)、網(wǎng)站排名、電子商務(wù)、網(wǎng)站設(shè)計(jì)公司

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來源: 創(chuàng)新互聯(lián)

成都網(wǎng)站建設(shè)公司