zoukankan      html  css  js  c++  java
  • overflow-y:auto 回到顶部

    overflow-y        内容溢出元素框时发生的事情。

    overflow-y:auto        内容溢出元素框时自动出现滚动条,滑动滚动条显示溢出的内容。

    滚动条回到顶部

    var container = $('#id');//获取元素
    $(container).scrollTop(0);//滚动条回到顶部

     1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
     2 <html>
     3 
     4 <head>
     5     <title> overflow-y 回到顶部 </title>
     6     <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
     7     <script type="text/javascript" src="./jquery-3.2.0.js"></script>
     8     <script type="text/javascript">
     9     $(function() {
    10         $('#btn').click(function() {
    11             $('html,body').animate({scrollTop: '0px'}, 800);
    12             var container = $('#div1');
    13             $(container).scrollTop(0);
    14         })
    15     })
    16     </script>
    17 </head>
    18 
    19 <body>
    20         <div id="div1" style="overflow-y:auto; height:200px;">
    21             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.
    22         </div>
    23     <input id="btn" type="button" value="回到顶部">
    24 </body>
    25 
    26 </html>
  • 相关阅读:
    多个tab切换demo
    react添加和删除定时器的地方
    编写C语言的两种方法----Visual Studio/CodeBlocks
    C++学习笔记---引用的本质
    C++学习笔记---指针
    C++学习笔记---数据类型
    博客园皮肤SimpleMemory深色风格皮肤
    SQL DELETE语句如何让表使用别名的方法
    Asp.Net实现局部刷新,ScriptManager和UpdatePanel控件的使用
    由于可能不会将凭据发送到远程计算机,因此将不会进行连接。若要获得协助,请与您的系统管理员联系。(转)
  • 原文地址:https://www.cnblogs.com/wangxiaoce/p/6629604.html
Copyright © 2011-2022 走看看