resize - Resizing a parent div with jQuery -


i'm trying set page when user clicks on 1 of letters within 3 divs, div resizes , "covers" other 2 divs on screen - hit brick wall jquery statement - know involves resize function (and css function) can't figure out life of me how it.

html/css

<div class="container">     <div id="home" class="group">   <span class="lettering" id="a">                         </span>      </div>     <div id="portfolio" class="group" style="margin-left: -4px;">   <span class="lettering" id="p">             p             </span>      </div>     <div id="contact" class="group" style="margin-left: -4px;"> <span class="lettering" id="c">             c             </span>      </div> </div>  html, body {     font-size: 1em;     background: #fff;     height: 100%; } .container {     width: 100%;     height: 100%; } #home {     background-color: #4d90fe; } .group {     height: 100%;     text-align: center;     position: relative;     display: inline-block; } #portfolio {     background-color: #dd4b39; } #contact {     background-color: #777777; } .lettering {     color: #fff;     font: bolder 7em'bitter bold';     vertical-align: middle;     position: relative; } 

jquery

jquery(document).ready(function () {     /*------------------------     set divs 1/3 width of screen     ------------------------*/     $(".group").css("width", ($(window).width() * 1 / 3));     $(window).resize(function () {         $(".group").css('height', $(window).height());         $(".group").css("width", ($(window).width() * 1 / 3));     });     /*------------------------     vertically center div     ------------------------*/     $('.lettering').css("top", ($('.group').height() - $('.lettering').height()) / 2);     /*-----------------------     expand div on element click     -----------------------*/     $('.lettering').click(function () {         $(this).parent().resize(function () {             /* ??? */         });     }); }); 

http://jsfiddle.net/qg8zd/

position divs absolute, , change div of hath been clicked:

jquery(document).ready(function () {     $(".group").each(function(index, element)     {         var len = $(".group").length;         //console.log((100 / len * index) + "%");         $(element).css("left", (100 / len * index) + "%");     });      $('.lettering').click(function ()     {         $(this).parent().animate({ width: "100%", left: 0 }, 500).css("z-index", 1);     }); }); 

fiddle

resize not think, event fired when window element size changes user.

/edited accommodate changes /edited again animation


Comments

Popular posts from this blog

ios - UICollectionView Self Sizing Cells with Auto Layout -

node.js - ldapjs - write after end error -

DOM Manipulation in Wordpress (and elsewhere) using php -