Advertisement
Guest User

Untitled

a guest
May 11th, 2013
149
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
jQuery 1.86 KB | None | 0 0
  1. if($('#'+thisSection).children('article').length>0) {
  2.     if($('#'+thisSection).children('article').css('display')=='none') {
  3. //reopen section
  4.         thisContent=document.getElementById(thisSection).getElementsByTagName('article')[0];
  5.         thisContent.style.display="block";
  6.         thisContent.style.height=0;
  7.         scissors.style.width="95%";
  8.         thisWhite.style.width="100%";
  9.         setTimeout(function() { thisContent.style.height=contentHeight[thisSection]; },1);
  10.         setTimeout(function() { thisContent.className += " sectionBorder"; },250);
  11.     }
  12.     else {
  13. //close section
  14.         thisContent=document.getElementById(thisSection).getElementsByTagName('article')[0];
  15.         thisContent.style.height=0;
  16.         thisWhite.style.width="0.4em";
  17.         scissors.style.width=scissorWidth;
  18.         setTimeout(function() { thisContent.className -= " sectionBorder"; },250);
  19.         setTimeout(function() { thisContent.style.display="none"; },500);
  20.     }
  21. }
  22. else {
  23. //open section for the first time
  24.     $('#'+thisSection).append(data+'\r\n\t\t\t\t'+'<footer class="white"></footer>');
  25.     thisContent=document.getElementById(thisSection).getElementsByTagName('article')[0];
  26.     $(thisContent).wrapInner('<div />');
  27.     contentHeight[thisSection]=(window.getComputedStyle(thisContent).getPropertyValue('height'));
  28.     console.log('contentHeight[thisSection] = '+contentHeight[thisSection]);
  29. //outputs "contentHeight[thisSection] = 48px"
  30.     thisContent.style.height=0;
  31.     if(!scissorWidth) {
  32.         scissorWidth=window.getComputedStyle(scissors).getPropertyValue('width');
  33.         console.log('scissorWidth = '+scissorWidth);
  34.     //outputs "scissorWidth = 19.2px"
  35.     }
  36.     scissors.style.width=scissorWidth;
  37. //width has been set to 0
  38.     setTimeout(function() {
  39.         scissors.style.width="95%";
  40.         thisWhite.style.width="100%";
  41.     }
  42.     ,1);
  43.     setTimeout(function() { thisContent.style.height=contentHeight[thisSection]; },1);
  44. //height has been set correctly
  45.     setTimeout(function() { thisContent.className += " sectionBorder"; },250);
  46. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement