»
AnglaisFran�aisVietnamien

Imprimer - Collapsible 3-Column Layout - JavaScriptBank.com

Version compl�te: jsB@nk » Form » Table » Collapsible 3-Column Layout
URL: https://www.javascriptbank.com/crossbrowser-collapsible-3-column-layout.html

Collapsible 3-Column Layout © JavaScriptBank.comCeci est un exemple de prendre l'une des trois colonnes populaires CSS BlueRobot de mises en page et en ajoutant un peu de JavaScript pliables afin de permettre à gauche et à droite des colonnes. Le but de cet exercice est d'utiliser des preuves CSS mise en page, sans modifier l'original CSS ou html original structure.

Version compl�te: jsB@nk » Form » Table » Collapsible 3-Column Layout
URL: https://www.javascriptbank.com/crossbrowser-collapsible-3-column-layout.html



JavaScript
<script type="text/javascript">var enabled = false;var alphaVisible = true;var betaVisible = true;window.onload = function(){  e = xGetElementById('navAlpha');  if (e && xDef(e.style) && document.getElementsByTagName) {    enabled = true;  }}function toggleAlpha(){  if (!enabled) return;  var d, m, e, a, i;  if (alphaVisible) {    d = 'none';    m = '0px';  }  else {    d = 'block';    m = '170px';  }  e = xGetElementById('navAlpha');  e.style.display = d;  a = xGetElementsByClassName('content');  for (i = 0; i < a.length; ++i) {    a[i].style.marginLeft = m;  }  alphaVisible = !alphaVisible;}function toggleBeta(){  if (!enabled) return;  var d, m, e, a, i;  if (betaVisible) {    d = 'none';    m = '0px';  }  else {    d = 'block';    m = '210px';  }  e = xGetElementById('navBeta');  e.style.display = d;  a = xGetElementsByClassName('content');  for (i = 0; i < a.length; ++i) {    a[i].style.marginRight = m;  }  betaVisible = !betaVisible;}</script><!--    This script downloaded from www.JavaScriptBank.com    Come to view and download over 2000+ free javascript at www.JavaScriptBank.com-->


HTML
<link rel="stylesheet" type="text/css" href="x_3col_fm.css"><script type="text/javascript" src="x_core.js"></script><script type="text/javascript" src="x_dom.js"></script><div class="content" style="margin-left: 0px; margin-right: 0px;">  <h1>Collapsible 3-Column Layout</h1>  <p>This is an example of taking one of the popular three-column CSS layouts from BlueRobot and adding a little javascript to enable collapsible left and right columns.</p>  <p>The purpose of this exercise is to utilize a proven CSS layout without modifying the original CSS or original html structure.</p>  <p>I&#39;m sure I have not chosen the most efficient implementation. But I was able to implement this very quickly because I already had the function xGetElementsByClassName written.</p>  <p>Enjoy,<br>Mike Foster</p>  <button onclick="toggleAlpha()">Toggle Alpha Column</button>  <button onclick="toggleBeta()" style="margin-left: 20px;">Toggle Beta Column</button></div><div class="content" style="margin-left: 0px; margin-right: 0px;">  <h2>But I must explain...</h2>  <p>Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo. Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos qui ratione voluptatem sequi nesciunt. Neque porro quisquam est, qui do<a href="http://lipsum.com/" title="Read about Lorem Ipsum at lipsum.com">lorem ipsum</a>quia dolor sit amet, consectetur, adipisci velit, sed quia non numquam eius modi tempora incidunt ut labore et dolore magnam aliquam quaerat voluptatem. Ut enim ad minima veniam, quis nostrum exercitationem ullam corporis suscipit laboriosam, nisi ut aliquid ex ea commodi consequatur? Quis autem vel eum iure reprehenderit qui in ea voluptate velit esse quam nihil molestiae consequatur, vel illum qui dolorem eum fugiat quo voluptas nulla pariatur?</p></div><div class="content" style="margin-left: 0px; margin-right: 0px;">  <h2>On the other hand...</h2>  <p>At vero eos et accusamus et iusto odio dignissimos ducimus qui blanditiis praesentium voluptatum deleniti atque corrupti quos dolores et quas molestias excepturi sint occaecati cupiditate non provident, similique sunt in culpa qui officia deserunt mollitia animi, id est laborum et dolorum fuga. Et harum quidem rerum facilis est et expedita distinctio. Nam libero tempore, cum soluta nobis est eligendi optio cumque nihil impedit quo minus id quod maxime placeat facere possimus, omnis voluptas assumenda est, omnis dolor repellendus. Temporibus autem quibusdam et aut officiis debitis aut rerum necessitatibus saepe eveniet ut et voluptates repudiandae sint et molestiae non recusandae. Itaque earum rerum hic tenetur a sapiente delectus, ut aut reiciendis voluptatibus maiores alias consequatur aut perferendis doloribus asperiores repellat.</p></div><div id="navAlpha" style="display: none;">  <h2>Links</h2>  <p></p>  <p><a href="http://jsbank.beplaced.com/">Link 1</a></p>  <p><a href="http://jsbank.beplaced.com/">Link 2</a></p>  <p><a href="http://jsbank.beplaced.com/">Link 3</a></p>  <hr>  <p><a href="http://jsbank.beplaced.com/">Link 4</a></p>  <p><a href="http://jsbank.beplaced.com/">Link 5</a></p>  <hr>  <p><a href="http://jsbank.beplaced.com/">Link 6</a></p>  <p><a href="http://jsbank.beplaced.com/">Link 7</a></p>  <p><a href="http://jsbank.beplaced.com/">Link 8</a></p></div><div id="navBeta" style="display: none;">  <h2>Sed ut perspiciatis...</h2>  <p>But I must explain to you how all this mistaken idea of denouncing pleasure and praising pain was born and I will give you a complete account of the system, and expound the actual teachings of the great explorer of the truth, the master-builder of human happiness. No one rejects, dislikes, or avoids pleasure itself, because it is pleasure, but because those who do not know how to pursue pleasure rationally encounter consequences that are extremely painful. Nor again is there anyone who loves or pursues or desires to obtain pain of itself, because it is pain, but because occasionally circumstances occur in which toil and pain can procure him some great pleasure. To take a trivial example, which of us ever undertakes laborious physical exercise, except to obtain some advantage from it? But who has any right to find fault with a man who chooses to enjoy a pleasure that has no annoying consequences, or one who avoids a pain that produces no resultant pleasure?</p></div><!--    This script downloaded from www.JavaScriptBank.com    Come to view and download over 2000+ free javascript at www.JavaScriptBank.com-->


Files
http://javascriptbank.com/javascript/form/crossbrowser/x_core.jshttp://javascriptbank.com/javascript/form/crossbrowser/x_3col_fm.csshttp://javascriptbank.com/javascript/form/crossbrowser/x_dom.js