I'm trying to use the
Position Method on table elements within an iframe in order to shift the elements away from the edge of the iframe if they're too close. I'm using this for faux Select elements that are near the bottom of the page, but instead of shifting the elements with
collision: "fit", they're moving to the top of the page.
I tested
collision: "flip" just to be sure, and was surprised to discover that it didn't position anything and allowed the element to be cut off. I've also tried adding an option for
'within' (using the div for the page content) but that didn't help either.
JS
- $("#dropdown_container1").position({
- my: "left top",
- at: "left bottom",
- of: "#dropdown_box1",
- collision: "fit"
- });
- $(function () {
- $("#dropdown_box1").click(function () {
- $("#select1").show();
- });
- });
- $(function () {
- $("#select1").menu();
- });
HTML
- <table>
- <tr>
- <td>
- <div id="dropdown_box1" class="dropdown_box"><span>1st Priority</span>/div>
- <div class="dropdown_container" id="dropdown_container1">
- <ul id="select1">
- <!-- Several List items --!>
- </ul>
- </div>
- </td>
- </tr>
- </table>
CSS
- .dropdown_box {display:block; border: 1px solid #d3d3d3;}
- .dropdown_container {position:relative;}
- .dropdown_container ul {display:none; position:absolute; top:0px; left:0px; list-style:none; border:1px solid #d3d3d3;}
- .dropdown_container ul li ul { display:none; position:absolute; top:0px; left:0px; list-style:none; border:1px solid #d3d3d3;}