Cascading Style Sheets Tutorial

Web effects: CSS + JS Construction of the picture viewer

  CSS + JS Construction of the picture viewer 

  This is a use of CSS + JS Construction of the simple picture viewer with thumbnail click to view map, can each picture showed the description of the display location of a fixed width and height in excess of hiding, click on the map to see full size, compatibility: IE, Firefox, Opera. 

  JS part 

  The following is quoted fragment: 
  Function showPic (whichpic) ( 
  If (document.getElementById) ( 
  Document.getElementById ( 'placeholder'). Src = whichpic.href; 
  If (whichpic.title) ( 
  Document.getElementById ( 'desc'). ChildNodes [0]. NodeValue = whichpic.title; 
  Else () 
  Document.getElementById ( 'desc'). ChildNodes [0]. NodeValue whichpic.childNodes = [0]. NodeValue; 
  ) Return false; 
  Else () 
  Return true; 
  )) 

  Xhtml 

  The following is quoted fragment: 
  <div Id="album"> 
  <div Id="pic"> 
  <img Src="第一张大图的地址" alt="" id="placeholder" /> 
  </ Div> 
  <p Id="desc"> first described Da map </ p> 
  <div Id="thumbs"> 
<ul>
  <li> <a Onclick="return showPic(this);" href="第一张大图的地址" title=""> 
  <img Src="第一张小图的地址" alt="" /> </ a> </ li> 
.
.
.
  </ Ul> 
  </ Div> 
  </ Div> 

  CSS code, see end of article Demo Download 

  Now the effect of 

  Because the figure shows the location of a fixed size, but the size of each picture is different, so the results of running the code above is not ideal, but also click on the View larger size of the code entirely, a good here LightBox effect. 

  In the above code to join JS 

  Document.getElementById ( 'ShowLightBox'). Href = whichpic.href; 

  A lightbox need a big label, there are plans address.  .

  District head to join lightbox code. 

  In the above code into xhtml 

  The following is quoted fragment: 
  <div Id="pic"> <a href="第一张大图的地址" rel="lightbox" id="ShowLightBox"> 
  <img Src="第一张大图的地址" alt="点击查看完全尺寸" id="placeholder" /> </ a> 
  </ Div> 

Share and Enjoy: These icons link to social bookmarking sites where readers can share and discover new web pages.
  • Digg
  • del.icio.us
  • Facebook
  • Google
  • DotNetKicks
  • DZone

Tags: css effects firefox, div effects

Releated Posts

  • Web effects: expression will be JS, Css combine
  • Let css website effects of translucent picture of web pages
  • More than 30 CSS navigation menu effects
  • CSS production standard navigation menu effects
  • Layer translucent effect css effects

This entry was posted on Friday, February 8th, 2008 at 12:00 am and is filed under Css+Div Web Design. You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.

« CSS: Beyond the layout grid
Talk about the function of experience web2.0 »

Leave a Reply

  • Categories

    • CSS Properties (491)
    • CSS Tutorial (1154)
    • CSS Tutorial By Examples (1201)
    • Css+Div Web Design (3274)
    • Xhtml and Web Design (1797)
  • Archives

    • February 2008
    • January 2008
    • December 2007
    • November 2007
    • October 2007
    • September 2007
    • August 2007
    • July 2007
    • June 2007
    • May 2007
    • April 2007
    • March 2007
    • February 2007
    • January 2007
  • Pages

    • About us

Cascading Style Sheets Tutorial