jQuery Movable Modal Dialog Box

前端 未结 3 664
南旧
南旧 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: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:

    
    
    
    <​div id="modal">
    click me​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​

    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();   
    });​
    

提交回复
热议问题