Implement Div, CSS, and JavaScript to hide and reproduce the floating Section

Source: Internet
Author: User

If you frequently access the Internet, you will find some advertisement floating sections. Click to hide, and only a small part of the area is left on the edge. When you move the mouse to the small part of the area, the advertisement is very active again in your sight. In this example, Div, CSS, and JavaScript are used to achieve this effect. It is tested in a variety of browsers.

First, let's take a look. This figure shows the effect of the DIV section floating on the left side of the browser:

It is the effect of hiding the DIV section and leaving only one reproduction arrow.

 

Put it bluntlyCode:

 <  Html  Xmlns  = "Http://www.w3.org/1999/xhtml"  >  <  Head  >      <  Title > Implement Div, CSS, and JavaScript to hide and reproduce the floating Forum-plan-blog Garden </  Title  >      <  Meta  Name  = "Description"  Content  = "Div, CSS, and javascript can be hidden and reproduced in the floating section. Jihua.cnblogs.com"   />  </  Head  >  < Body  >  <  Div  ID  = "Jiadeframe"  Style  = "Width: 100px; Border: 1px solid #666; Z-index: 3; position: absolute; top: 300px; Right: 1px ;"  >  <  Div  ID  = "Jistmcontent"  >  Content  < BR  />  Content  <  BR  />  Content  <  BR  />  Content  <  BR  /> Content <  BR  /> Content <  BR  /> Content <  BR  /> Content <  BR  /> Content <  BR  />  Content  <  A  Href = "Http://jihua.cnblogs.com"  Target  = "_ Blank"  Style  = "Text-Decoration: none; color: black ;"  > Plan </  A  >  </  Div  >  <  Div  Onmouseover = "Javascript: jihuashowobj ('jiateframework', 'jiatecontent ')"  > <  A  Href  = "Javascript: jiadehideobj ('jiateframework', 'jiatecontent ')"  Style  = "Text-Decoration: none; color: Blue ;"  > <  -  > </  A  > </  Div  >  </ Div  >  <  Script  Language  = "JavaScript"  Type  = "Text/JavaScript"  >      Function  Jiadehideobj (frameid, contentid ){  VaR  Theobj  = Document. getelementbyid (frameid); document. getelementbyid (contentid). style. Display  =   '  None  '  ; Theobj. style. Right  =  (  12   - Parseint (theobj. style. width ))  +   "  Px  "  ;  //  Remember PX jihua.cnblogs.com  }  Function  Jihuashowobj (frameid, contentid ){ VaR  Thecontentobj  =  Document. getelementbyid (contentid );  If  (Thecontentobj. style. Display  =   '  None  '  ) {Thecontentobj. style. Display =   '  Block  '  ; Document. getelementbyid (frameid). style. Right  =   '  1px  '  ;  // Remember PX jihua.cnblogs.com  }}  </  Script  >  </  Body  >  </  Html  > 

 

For the effect, see the right side of the browser.

 

Content
Content
Content
Content
Content
Content
Content
Content
Content
Content plan <->

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.