Return to the top button for rolling and dynamic display and hiding. Return to the top button
Many websites have the function of returning to the top to judge the dynamic display and hiding of rolling parameters. This function is suitable for beginners.
<! DOCTYPE html PUBLIC "-// W3C // dtd xhtml 1.0 Transitional // EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
Return to the Code on the top of the page. Hide the code when the page is not rolled. The code is displayed after the page is rolled.
Sadfjasdkf <br/> asdfjlk <br/> sadfjasdkf <br/> asdfjlk <br/> sadfjasdkf <br/> asdfjlk <br/> sadfjasdkf <br/> asdfjlk <br/> sadfjasdkf <br/> asdfjlk <br/> sadfjasdkf <br/> asdfjlk <br/> sadfjasdkf <br/> asdfjlk <br/> sadfjasdkf <br/> asdfjlk <br/>
<Script language = "jav ...... remaining full text>
How to fix the button position on the top returned by html css
In many cases, you need to fix the div, such as the online consulting module. This requires that the div be fixed at the position of the display page, rather than scrolling with the scroll bar.
Idea: Make a fixed div into a floating frame to coincide with other div blocks. Then, when the scroll bar event is triggered, the div coordinates are dynamically changed.
Code:
In jsp:
<Body>
<Div style = "position: absolute; z-index: 90" id = "div1"> I don't move </div>
<Div> I am <div>
</Body>
// Some set the position to fixed. I tried to set the position to be better than the position. Set the z-index to the depth in the direction. I set it to 90 here. You need to overwrite several Divs, set the number to be greater than that.
Js:
I will write it here using jquery.
$ (Document). ready (function (){
$ (Window). scroll (function () {// triggers a function when scrolling
$ ("# Div1" ).css ("top", $ (document). scrollTop (); // assign the height of the scroll bar to the floating box.
// Add the sentence here
})
I do not have the scroll bar below, because there is no test, so it is not easy to write, if you want to try, try to add a sentence
$ ("# Div1" ).css ("right", $ (document). scrollRight (); // assign the height of the scroll bar to the floating box.
Import the jquery library.