本文實例講述了jQuery響應滾動條事件功能。分享給大家供大家參考,具體如下:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><title>無標題文檔</title><script type="text/javascript" src="jquery-1.7.2.min.js"></script><script type="text/javascript">$(function() { var lazyheight = 0; //獲取數據 function showload() { lazyheight = parseFloat($(window).height()) + parseFloat($(window).scrollTop()); if ($(document).height() - 100 <= lazyheight) { alert("xxx"); } } //showload(); //綁定事件 $(window).bind("scroll", function() { //當滾動條滾動時 showload(); });})</script></head><body><img src="1.jpg"/><br/><img src="2.jpg"/><br/><img src="3.jpg"/></body></html>更多關于jQuery相關內容感興趣的讀者可查看本站專題:《jQuery切換特效與技巧總結》、《jQuery拖拽特效與技巧總結》、《jQuery擴展技巧總結》、《jQuery常見經典特效匯總》、《jQuery動畫與特效用法總結》、《jquery選擇器用法總結》及《jQuery常用插件及用法總結》
希望本文所述對大家jQuery程序設計有所幫助。
新聞熱點
疑難解答