jquery使页面滚动到底部

function scrollToEnd(){//滚动到底部
            var h = $(document).height()-$(window).height();
            $(document).scrollTop(h);
}

(摘抄自http://www.cnblogs.com/hui-blog/p/5526278.html)

时间: 2024-08-27 17:02:29

jquery使页面滚动到底部的相关文章

jQuery判断页面滚动到底部

有时候我们需要页面滚动到底部的时候去加载更多的数据,实现思路基本上就是判断浏览器页面是否滚动到了页面底部,当滚动到页面底部的时候,用AJAX异步获取数据然后加载到页面中. 利用jQuery判断浏览器页面是否滑动到了底部: <script type="text/javascript"> // scroll event $(window).scroll(function(){ // scroll at bottom if ($(window).scrollTop() + $(w

jquery让页面滚动到底部

function scrollToEnd(){//滚动到底部 var h = $(document).height()-$(window).height(); $(document).scrollTop(h); }

js原生 + jQuery实现页面滚动字幕

js原生/jQuery实现页面滚动字幕效果 17:45:49 在新闻列表或者文章列表信息等页面中很容易要求实现字幕滚动的效果,以下为简单的实现页面中滚动字幕的效果 1.jQuery实现页面滚动字幕效果 代码如下: <div class="box"> <ul class="list"> <li>这是滚动加载的第1条数据</li> <li>你猜猜这是第几条滚动加载的文字</li> <li>

页面滚动到底部自动加载下一页功能的实现

页面滚动到底部自动加载下一页功能的实现,效果见本博首页 1.endlesspage.js文件内容 var gPageSize = 10; var i = 1; //设置当前页数,全局变量 var finished = false; var dataUrl = ''; $(function () { //根据页数读取数据 function getData(pagenumber) { //console.log(i); $.get(dataUrl, { pagesize: gPageSize, p:

jQuery实现页面滚动时智能浮动定位

<!DOCTYPE html><html><head>    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />    <title>jQuery实现页面滚动时层智能浮动定位_前端开发</title>    <style type="text/css">        * { 

js-让页面滚动最底部,显示到最底部

应用场景,聊天webapp中,让页面初始化的时候或者页面更新的时候,都让页面显示在最底部的聊天内容 可以借助react中的两个生命周期函数 componentDidMount和componentDidUpdate componentDidMount() { // 初始显示列表, 让页面滚动到底部scrollTo(x轴0, Y轴为内容滚动的高度) window.scrollTo(0, document.body.scrollHeight) } componentDidUpdate () { //

[jquery]判断页面滚动到顶部和底部(适用于手机web加载)

//判断页面滚动到顶部和底部 $(window).scroll(function(){ var doc_height = $(document).height(); var scroll_top = $(document).scrollTop(); var window_height = $(window).height(); if(scroll_top == 0){ alert("到顶啦"); }else if(scroll_top + window_height >= doc

使页面滚动到指定元素+优化+API介绍(JS动画)

前言 当页面最上部有顶部菜单是,使用锚点跳转的方法很容易挡住想要呈现的内容(如下图技能两个字被挡住了一半),为避免出现这样的问题,故滚动到指定元素使用用JS的方法来实现. 1  使用的API简介 document.querySelectorAll preventDefault currentTarget getAttribute document.querySelector offsetTop window.scrollTo 2  初版 代码及思路如下: //1 点击导航跳到指定位置第一步,获取

安卓使ScrollView滚动到底部代码

在开发中,我们经常需要更新列表,并将列表拉倒最底部,比如发表微博,聊天界面等等, 这里有两种办法,第一种,使用scrollTo(): public static void scrollToBottom(final View scroll, final View inner) { // 何问起 hovertree.com Handler mHandler = new Handler(); mHandler.post(new Runnable() { public void run() { if (