最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - How to make the popup div draggable - Stack Overflow

programmeradmin0浏览0评论

i'm trying to make a popup to draggable. does anyone help me how to do that, here is my code

/

$(document).ready(function(){
    function showAlertBox(){
     $("#alert").css("display","inherit");
     $("#content").addClass("back");
    }
    function removeAlertBox(){
        $("#alert").css("display","none");
         $("#content").removeClass("back");        
    }



    $("#alertClose").click(function(){
       removeAlertBox(); 
    });
    $("#alertShow").click(function(){
       showAlertBox(); 
    });

    $( "#alert" ).draggable();

});

i'm trying to make a popup to draggable. does anyone help me how to do that, here is my code

http://jsfiddle/Ur5Xn/38/

$(document).ready(function(){
    function showAlertBox(){
     $("#alert").css("display","inherit");
     $("#content").addClass("back");
    }
    function removeAlertBox(){
        $("#alert").css("display","none");
         $("#content").removeClass("back");        
    }



    $("#alertClose").click(function(){
       removeAlertBox(); 
    });
    $("#alertShow").click(function(){
       showAlertBox(); 
    });

    $( "#alert" ).draggable();

});
Share Improve this question asked Oct 25, 2013 at 7:36 XaviXavi 2,5947 gold badges43 silver badges59 bronze badges 2
  • 9 Your code works fine, you just forgot to include jquery-ui, which is where draggable es from. – orhanhenrik Commented Oct 25, 2013 at 7:38
  • Izzey is onto it, just include jquery-ui plugin – gwillie Commented Oct 25, 2013 at 7:41
Add a ment  | 

4 Answers 4

Reset to default 2

You did not load Jquery UI in your fiddle. It works fine.

Just turn on JQuery Ui. You can try enabling it in JSfiddle, on the right top corner and see that your code works.

your code is working good kindly include plugin script after the jquery plugin.. it will sureky work..

Just try to check "jQuery UI 1.10.3" (top left of the page) in your JSfiddle, it works with me.

发布评论

评论列表(0)

  1. 暂无评论