Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

Great Html Tab Panel Using CSS and Javascript

I needed a tab pane to put some content in my web pages. There are many solutions around
and I must say that they are quite good, but I had some extra requirements that I needed.
I did search around but I did not find what I wanted, so I ended up producing something and now I am sharing
it with you. The idea is not just to share the code but also explain
the issues involved.
The Tabbed Pane Content should be all downloaded with the page
This is quite a Web 2.0 thing, and I must say it was not an absolute requirement, but since I am at it
I may as well do it in a good way.
The requirement is that the content of the panels should be downloaded with the page that defines the panels
and therefore when the user switches panels there will not be any delay, the content is already there
.
The tab Panel should coexist with other content
Quite a few of the tabbed panels around basically take over the content. This simply means that
you design the page around the tabbed pane and it is quite difficult to put extra content in it.
I wanted a tab panel that fits inside some content I have
and not one that takes over my page.
Note that this means avoiding as much as possible fixed width and height
and using as much as possible
all the available screen size. Not easy...
The issues that have been solved
Before giving you the solution I will describe the issues involved, so you can understand better
what the code does and change it to suit your needs.
Where to store the different content
I could have stored the content in a Javascript variable and then push
it into
the current DIV (this may be something I do in the future) but as it is now I am inserting the
content of the different panels into different DIV, each one having a separate ID. This surely makes writing the
actual content of the panel easy.
How to overlap the various DIV
This is kind of simple, the way to overlap content is by means of using a DIV set to relative positioning
and then putt


Ïà¹ØÎĵµ£º

CSSÖÐ10¼þÄãÐèÒªÖªµÀµÄÊÂ


1.  CSSµÄÒªµãÊÇÔÚÄãµÄÒ³ÃæÖÐʹÓüò½àµÄHTML´úÂë,È»ºó±àдCSS"¿ØÖƹæÔò"À´Ñùʽ»¯Ò³ÃæÖеĶÔÏó.Ò³Ãæ±£³ÖÇåÎúÓÐÌõ²»ÎÉ¿´ÉÏÈ¥·Ç³£°ô.ÕâÑùÄãµÄHtmlÒ³Ãæ¿ÉÒÔÔÚÒƶ¯É豸ºÍ±ê×¼ä¯ÀÀÆ÷ÖÐÔËÐÐ.Õâ¾ÍÊÇCSSµÄÒªµã.
²»¹ýCSSµÄÒÕÊõÔÚÓÚÄܹ»ÀûÓÃCSS¿ØÖƹæÔò¿ìËÙÓÐЧµØ²Ù×ÝÒ³Ãæ¶ÔÏó.°ÑCSS¹æÔòÓëHTML±ê¼ÇÆ¥ÅäÆðÀ´µÄ²Ù×ö¾ÍºÃÏñÊÇÒ»ÖÖ¶ ......

CSS HACK»ã×Ü¿ì²é


ÆÁ±ÎIEä¯ÀÀÆ÷£¨Ò²¾ÍÊÇIEϲ»ÏÔʾ£©
*:lang(zh) select {font:12px  !important;} /*FF,OP¿É¼û£¬ÌرðÌáÐÑ£ºÓÉÓÚOpera×î½üµÄÉý¼¶£¬Ä¿Ç°´Ë¾äֻΪFFËùʶ±ð*/
select:empty {font:12px  !important;} /*safari¿É¼û*/
ÕâÀïselectÊÇÑ¡Ôñ·û£¬¸ù¾ÝÇé¿ö¸ü»»¡£µÚ¶þ¾äÊÇMACÉÏsafariä¯ÀÀÆ÷¶ÀÓеġ£½öIE7ÓëIE5.0 ......

HTMLÖÐMeta±êÇ©Ïê½â

ºÜ¶àÈ˺öÊÓÁËHTML±êÇ©METAµÄÇ¿´ó¹¦Ð§£¬Ò»¸öºÃµÄMETA±êÇ©Éè¼Æ¿ÉÒÔ´ó´óÌá¸ßÄãµÄ¸öÈËÍøÕ¾±»ËÑË÷µ½µÄ¿ÉÄÜÐÔ£¬ÓÐÐËȤÂð£¬Ë­ÎÒÀ´ÖØÐÂÈÏʶһÏÂMETA±êÇ©°É£¡
META±êÇ©ÊÇHTMLÓïÑÔHEADÇøµÄÒ»¸ö¸¨ÖúÐÔ±êÇ©£¬ËüλÓÚHTMLÎĵµÍ·²¿µÄ<HEAD>±ê¼ÇºÍ<TITLE>±ê¼Ç
Ö®¼ä£¬ËüÌṩÓû§²»¿É¼ûµÄÐÅÏ¢¡£meta±êǩͨ³£ÓÃÀ´ÎªËÑË÷ÒýÇærobo ......

JQueryÅжÏHTMLÔªËØÊÇ·ñ´æÔÚ

jsµÄ·½·¨£º
if(document.getElementById('example')) {  
    // do something  
}  
else {  
    // do something else  

jqueryµÄ·½·¨£º
 
if($('#example').length) {  
    ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ