javascript - How do I change the position of this sliding text-area? -
i'm trying add disclaimer section website i'm working on. want tab-like button @ bottom of every page open text area.
i searched codepen.io bit , found simple way it. after removing non-relevant syntax, tried move tab top of page bottom.
here's came across problem. when tab @ top of page, text area push down tab when clicking on it.
now it's @ bottom, textarea shows above tab, tab itselfs stays @ bottom of page.
how make sure text area pops beneath tab, pushing tab up?
$(document).on('click', '#menu-tab', function() { $('#menu-nav').slidetoggle('slow'); });
body { background-color: #333333; text-align: center; } #menu-wrapper { position: absolute; bottom: 0; left: 0; width: 100%; } #menu-tab { background-color: #fc4349; cursor: pointer; margin: 0% 45% 0% 45%; padding: 5px 10px; } #menu-nav { display: none; background-color: #fc4349; margin: 0% 30% 0% 30%; }
<body> <div id="menu-wrapper"> <div id="menu-nav">disclaimertextdisclaimertextdisclaimertext <br>disclaimertextdisclaimertextdisclaimertext</div> <div id="menu-tab" class="closed">disclaimer</div> </div> <script src='http://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js'></script> </body>
in case description didn't give clear image of situation:
tab @ top of screen
tab @ bottom of screen
move html containing disclaimer below tab
(demo)
<div id="menu-wrapper"> <div id="menu-tab" class="closed">disclaimer</div> <div id="menu-nav">disclaimertextdisclaimertextdisclaimertext <br>disclaimertextdisclaimertextdisclaimertext</div> </div>
Comments
Post a Comment