div产生的滚动条如何回到顶部

57 篇文章 0 订阅
17 篇文章 0 订阅

        我话少,直接上代码,html代码比较乱,主要为了产生垂直滚动条,看js就Ok了,jquery.js自行下载,就不提供了,so easy!其实说白了就是控制这个div的垂直滚动条的偏移,这里回到顶部,所以就设置成0。顺带着也把页面的垂直滚动条也移到了最顶端。

 

 

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <title> New Document </title>
  <meta name="Generator" content="EditPlus">
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  <meta name="Author" content="">
  <meta name="Keywords" content="">
  <meta name="Description" content="">
  <script type="text/javascript" src="jquery.js">
  </script>
	<script type="text/javascript">
	$(function(){
		$('#btn').click(function(){
			$('html,body').animate({scrollTop: '0px'}, 800);
			var container = $('#div1');
			$(container).scrollTop(
				0
			);
		})
	})
	</script>
    
 </head>

 <body>
 <div style="overflow-y:auto; height:500px;">
	  <div  id="div1" style="overflow-y:auto; height:200px;"> <div id="row_8"></div>English is a West Germanic language that was first spoken in early medieval England and is now a global lingua franca.[4][5] It is spoken as a first language by the majority populations of several sovereign states, including the United Kingdom, the United States, Canada, Australia, Ireland, New Zealand and a number of Caribbean nations; and it is an official language of almost 60 sovereign states. It is the third-most-common native language in the world, after Mandarin Chinese and Spanish.[6] It is widely learned as a second language and is an official language of the European Union, many Commonwealth countries and the United Nations, as well as in many world organisations.

English arose in the Anglo-Saxon kingdoms of England and what is now southeast Scotland. Following the extensive influence of Great Britain and the United Kingdom from the 17th to mid-20th centuries through the British Empire, it has been widely propagated around the world.[7][8][9][10] Through the spread of American-dominated media and technology,[11] English has become the leading language of international discourse and the lingua franca in many regions.[12][13]

Historically, English originated from the fusion of closely related dialects, now collectively termed Old English, which were brought to the eastern coast of Great Britain by Germanic settlers (Anglo-Saxons) by the 5th century; the word English is derived from the name of the Angles,[14] and ultimately from their ancestral region of Angeln (in what is now Schleswig-Holstein). The language was also influenced early on by the Old Norse language through Viking invasions in the 9th and 10th centuries.
The Norman conquest of England in the 11th century gave rise to heavy borrowings from Norman French, and vocabulary and spelling conventions began to give the appearance of a close relationship with those of Latin-derived Romance languages (though English is not a Romance language itself)[15][16] to what had then become Middle English. The Great Vowel Shift that began in the south of England in the 15th century is one of the historical events that mark the emergence of Modern English from Middle English.

In addition to words inherited natively from Anglo-Saxon and those borrowed from Norman French, a significant number of English terms are derived from constructions based on root words originally taken from Latin, because Latin in some form was the lingua franca of the Christian Church and of European intellectual life[17] and remains the wellspring of much modern scientific and technical vocabulary.

Owing to the assimilation of words from many other languages throughout history, modern English contains a very large vocabulary, with complex and irregular spelling, particularly of vowels. Modern English has not only assimilated words from other European languages, but from all over the world. The Oxford English Dictionary lists more than 250,000 distinct words, not including many technical, scientific, and slang terms.
</div>
    </div>
	<input id="btn" type="button" value="test">
   <div data-role="header" data-position="fixed" data-fullscreen="true">
		<div data-role="navbar">
			<ul>
				<li><a href="#" data-role="button">首页</a></li>
				<li><a href="#" data-role="button">页面二</a></li>
				<li><a href="#" data-role="button">搜索</a></li>
			</ul>
		</div>
   </div>

   <div data-role="content" style="padding:8px;">
		<ul id="details11">	
			<li>
    			<a href="#" data-role="button">按钮</a>
			</li> 
		</ul>
	</div>
 </body>
</html>

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值