开发者

jQuery - vertically floating DIV

I've got an application with a three column layout where things move back and forth from the left column to the right column (and of course, back). In between, there is a "command menu" - things you can do based on blah blah blah.

Here's the deal - the items on the left side, on which you can act, are arranged vertically. I'd like to make the command menu follow the mouse (vertically, but within its column) so that when an item is selected for action, the menu is vertically aligned.

I'm perfectly (preferably?) willing to do this with jQuery, but my attempts have failed.

Here is the current markup:

<table class="stuff_area">
    <tr>
        <td id="stuff_left">
            <div class="shipmentList">
                <asp:Literal ID="ltrShipments" runat="server"></asp:Literal>
            </div>
        </td>
        <td id="stuff_controls" class="stuff_area_input">
            <div id="follower">
                <input id="btnAll" type="button" value="All" /><br/>
                <input id="btnNone" type="button" value="None" /><br />
                <input id="btnStuff" type="button" value=">>" /><br />
            </div>
        </td>
        <td id="stuff_right"></td>
    </tr>开发者_JS百科;
</table>

I'm specifically interested in making the div with class="follower" float up an down. FWIW, I can't get any movement, so there is a good chance that getting me some vertical movement (I want to limit its movement to up/down) will get you the win.

Ideas?


  $(function() {
    $(".stuff_area td").mouseenter( function( event ) {
      $("#follower").offset({ top: $(this).offset().top });
    } );
  });

The offset method should do what you want. I am assuming that your server control creates a table, so if not, replace .stuff_area td with a more appropriate selector.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜