<Html> <Head> <Title> Google Play's minimal tabs with CSS3 & jQuery-demo </title> <Style> Body { Width: 700px; Margin: 100px auto 0 auto; Font-family: Arial, Helvetica; Font-size: small; Background-color: # eee; Background-image: url (data: image/gif; base64, R0lGODlhCAAIAJEAAMzMzP // waaach5baehaaialaaaaiaagaaainhg4nudrogjbrsycxkaa7 ); } /*-------------------------------------------------*/ # Tabs { Overflow: hidden; Width: 100%; Margin: 0; Padding: 0; List-style: none; } # Tabs li { Float: left; Margin: 0-15px 0 0; } # Tabs { Float: left; Position: relative; Padding: 0 40px; Height: 0; Line-height: 30px; Text-transform: uppercase; Text-decoration: none; Color: # fff; Border-right: 30px solid transparent; Border-bottom: 30px solid # 3D3D3D; Border-bottom-color: #7779; Opacity:. 3; Filter: alpha (opacity = 30 ); } # Tabs a: hover, # Tabs a: focus { Border-bottom-color: #2ac7e1; Opacity: 1; Filter: alpha (opacity = 100 ); } # Tabs a: focus { Outline: 0; } # Tabs # current { Z-index: 3; Border-bottom-color: # 3d3d3d; Opacity: 1; Filter: alpha (opacity = 100 ); } /*-----------*/ # Content { Background: # fff; Border-top: 2px solid # 3d3d3d; Padding: 2em; /* Height: 220px ;*/ } # Content h2, # Content h3, # Content p { Margin: 0 0 15px 0; } /* Demo page only */ # About { Color: #999; Text-align: center; Font: 0.9em Arial, Helvetica; } # About { Color: #777; } </Style> </Head> <Body> <Ul id = "tabs"> <Li> <a href = "#" name = "# tab1"> One </a> </li> <Li> <a href = "#" name = "# tab2"> Two </a> </li> <Li> <a href = "#" name = "# tab3"> Three </a> </li> <Li> <a href = "#" name = "# tab4"> Four </a> </li> </Ul> <Div id = "content"> <Div id = "tab1"> <H2> Lorem ipsum sit amet <P> Praesent risus nisi, iaculis nec condimentum vel, rhoncus vel dolor. Aenean nisi lectus, varius nec tempus id, dapibus non quam. </p> <P> Suspendisse ac libero mauris. Cras lacinia porttitor urna, vitae extends libero posuere et. Mauris turpis tortor, mollis non vulputate sit amet, rhoncus vitae purus. <H3> Pellentesque habitant <P> Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia curae. </p> </Div> <Div id = "tab2"> <H2> Vivamus fringilla suscipit justo <P> Aenean dui nulla, egestas sit amet auctor vitae, facilisis id odio. Donec dictum gravida feugiat. </p> <P> Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Cras presponelit et erat condimentum et volutpat lorem vehicula </p> <P> Morbi tincidunt pharetra orci commodo molestie. Praesent ut leo nec dolor tempor eleifend. </p> </Div> <Div id = "tab3"> <H2> Phasellus non nibh <P> Non erat laoreet ullamcorper. Adjust magna metus, feugiat eu elementum sit amet, cursus sed diam. Curabitur posuere porttitor lorem, eu malesuada tortor faucibus sed. </p> <H3> Duis pulvinar nibh vel urna <P> Donec purus leo, porttitor eu molestie quis, porttitor sit amet ipsum. class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. donec accumsan ornare elit id imperdiet. </p> <P> sustmdisse ac libero mauris. Cras lacinia porttitor urna, vitae molestie libero posuere et. </p> </Div> <Div id = "tab4"> <H2> Cum sociis natoque penatibus <P> Magnis dis parturient montes, nascetur ridiculus mus. Nullam ac massa quis nisi porta mollis venenatis sit amet urna. Ut in mauris velit, bibsed endum turpis. </p> <P> Nam ornare vulputate risus, id volutpat elit porttitor non. in consequat nisi vel lectus dapibus sodales. pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. praesent bibendum sagittis libero. </p> <H3> Imperdiet sem interdum nec <P> Mauris rhoncus tincidunt libero quis fringilla. </p> </Div> </Div> <P id = "about"> Back to <a href = "/google-play-minimal-tabs-with-css3-jquery"> article </a>/Drop me a message on <a href = "http://twitter.com/catalinred"> Twitter </a>! </P> <Script src = "http://code.jquery.com/jquery-1.7.2.min.js"> </script> <Script> Function resetTabs (){ $ ("# Content> div"). hide (); // Hide all content $ ("# Tabs a"). attr ("id", ""); // Reset id's } Var myUrl = window. location. href; // get URL Var myUrlTab = myUrl. substring (myUrl. indexOf ("#"); // For localhost/tabs.html # tab2, myUrlTab = # tab2 Var myUrlTabName = myUrlTab. substring (0, 4); // For the above example, myUrlTabName = # tab (Function (){ $ ("# Content> div"). hide (); // Initially hide all content $ ("# Tabs li: first a"). attr ("id", "current"); // Activate first tab $ ("# Content> div: first"). fadeIn (); // Show first tab content $ ("# Tabs a"). on ("click", function (e ){ E. preventDefault (); If ($ (this). attr ("id") = "current") {// detection for current tab Return } Else { ResetTabs (); $ (This). attr ("id", "current"); // Activate this $ (This). attr ('name'). fadeIn (); // Show content for current tab } }); For (I = 1; I <= $ ("# tabs li"). length; I ++ ){ If (myUrlTab = myUrlTabName + I ){ ResetTabs (); $ ("A [name = '" + myUrlTab + "']"). attr ("id", "current"); // Activate url tab $ (MyUrlTab). fadeIn (); // Show url tab content } } })() </Script> <! -- BSA AdPacks code --> <Script> (Function (){ Var bsa = document. createElement ('script '); Bsa. async = true; Bsa. src = 'http: // www.red-team-design.com/js/adpacks-demo.js '; (Document. getElementsByTagName ('head') [0] | document. getElementsByTagName ('body') [0]). appendChild (bsa ); })(); </Script> </Body> </Html> |