jQuery Movable Modal Dialog Box

前端 未结 3 639
南旧
南旧 2020-12-30 13:05

I have been looking at all available jQuery plugins for a modal box that is draggable. The only problem is that every modal box I have found that is dragable requires a titl

相关标签:
3条回答
  • 2020-12-30 13:25

    A combination of jqModal and jqDnR will do this:

    • http://dev.iceburg.net/jquery/jqModal/
    • http://dev.iceburg.net/jquery/jqDnR/
    0 讨论(0)
  • 2020-12-30 13:39

    This simple method works for me:

    // first invoke jquery modal the standard way
    $('#myModal').modal();
    
    // now make it draggable
    $('#myModal').draggable();   
    
    0 讨论(0)
  • 2020-12-30 13:51

    Just make your own modal? There are tutorials for making the overlay but the basic functionality isn't really that hard.

    Fiddle: http://jsfiddle.net/calder12/mxWf8/1/

    HTML:

    <head>
    <script src="http://code.jquery.com/ui/1.9.2/jquery-ui.js"></script>
    </head>
    <​div id="modal"></div>
    <a href="#" class="click">click me</a>​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​
    

    CSS:

    #modal{
    border:4px solid #CCC;
    width:100px;
    height:50px;
    display:none;
    position:absolute;
    left:50%; 
    top:50%;
    margin:-25px 0 0 -50px;
    border-radius:5px;
    }   ​
    

    jQuery:

    $('.click').click(function(){
    $('#modal').show();
    $('#modal').draggable();   
    });​
    
    0 讨论(0)
提交回复
热议问题