animation - JQuery - .preventDefault() -
using code below have hide show effect applied table cells have width expanded , collapsed. problem when link clicked, text shows up, table resizes text disappears. unclicked text remain hidden throughout , not flash on screen. think might have preventdefault or return false when i've tried these has stopped table working @ after first click. not sure i'm doing wrong.
as always, appreciated.
<!doctype html public "-//w3c//dtd xhtml 1.0 transitional//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"><head> <meta http-equiv="content-type" content="text/html; charset=utf-8"> <title>levels of progression</title> <style> body{font-family:arial, helvetica, sans-serif; font-size:80%;} table td{vertical-align:top; padding:5px;} table td div{width:80px; overflow:hidden; display:none;} table td .togglesection1{width:200px; display:block;} .explore td{background:#c0da77;} #e1{color:#8bad30; width:200px;} #express td{background:#cf7db4;} #e2{color:#cf7db4; } #exchange td{background:#58bccc;} #e3{color:#3aaabe;} #evaluate td{background:#ab91c4;} #e4{color:#8864ac;} #exhibit td{background:#f7b930;} #e5{color:#e3a209;} table td a{color:black; text-decoration:none; } table td a:hover{color:white; background:black; } table td.title{font-size:1.3em; font-weight:bold; padding-bottom:0; margin-bottom:0; vertical-align:bottom;} .levels{text-align:center; font-size:1.3em; font-weight:bold; background:#ccc; font-family:georgia, "times new roman", times, serif;} .title{ font-family:georgia, "times new roman", times, serif;} #exchange .none{color:white; color:#cdebf0; font-style:italic;} #evaluate .none{color:white; color:#e6deed; font-style:italic;} </style> <script type="text/javascript" src="js/jquery.js"></script> <script type="text/javascript" src="js/thickbox.js"></script> <script type="text/javascript"> //<![cdata[ function showslidingdiv(column){ var maxwidth = 200; var smallwidth = 80; var smallheight = 50; var mywidth = $(column).width(); $("div").animate({width: smallwidth}, 400, function() { $(this).hide(); }); $(column).animate({width: maxwidth}, 400, function() { $(column).show(); }); } //]]> </script> </head><body> <table width="800" border="0" cellspacing="5"> <tbody><tr> <td> </td> <td class="levels"><a href="" onclick="showslidingdiv('.togglesection1'); return false;">level 1</a></td> <td class="levels "><a href="" onclick="showslidingdiv('.togglesection2'); return false;">level 2</a></td> <td class="levels "><a href="" onclick="showslidingdiv('.togglesection3'); return false;">level 3</a></td> <td class="levels "><a href="" onclick="showslidingdiv('.togglesection4'); return false;">level 4</a></td> <td class="levels "><a href="" onclick="showslidingdiv('.togglesection5'); return false;">level 5</a></td> </tr> <tr> <td class="title" id="e1">explore</td> <td><div class="togglesection1">text here:</div></td> <td><div class="togglesection2">text here:</div></td> <td><div class="togglesection3">text here:</div></td> <td><div class="togglesection4">text here:</div></td> <td><div class="togglesection5">text here:</div></td> </tr> <tr class="explore"> <td>some text in here </td> <td><div class="togglesection1">find , select information given digital source;</div> </td> <td><div class="togglesection2">find, select , use information given digital source;</div></td> <td><div class="togglesection3">research, select, edit , use information given digital sources;</div> </td> <td><div class="togglesection4"> research, select, edit , use assets range of digital sources;</div> </td> <td><div class="togglesection5">research, select, edit, use , evaluate assets range of digital sources;</div> </td> </tr> </tbody></table> </body></html>
problem during animation, element's display
property set block
. consider hiding/showing content css property visibility
instead. (an element visibility:hidden
still occupy place in layout, contents hidden.)
Comments
Post a Comment