English 中文(简体)
不要在酒吧开枪。
原标题:Drop event not firing in jQuery UI.

我正试图制定一个小型方案,使用户能够把装备包放在一起,以树立一个装置的形象。 http://oliverdjones.com

http://oliverdjones.com/search/dragtester.html“rel=“nofollow”http://oliverdjones.com/search/dragtester.html。

我正在使用 j。 拖拉事件正在像预期的那样发挥作用,但我尚未能够扑灭 drop火,我完全没有想法。 该法典:

<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>drag test</title>

    <style>
            .content {width:100%; height:100%;position: absolute;}
        #draggable img {width:100%}
        .part1 {position:absolute;width:100px; z-index: 5; margin-top:15%; margin-left:57%;}
        .drop1 {position:absolute;width:100px; height: 70px; z-index: 3; background-color:rgba(255,0,0,0.5);top:42%; left:45%; }
        .dropped1 {position:absolute;width:100px; height: 70px; z-index: 3; background-color:rgba(255,255,255,0.5);top:42%; left:45%;}
        .base {position:absolute; width: 17%; top:45%; left:42%;z-index: 2}
        .status {position:absolute; width: 160px; border:#000 solid 2px; text-align:center; -webkit-border-radius: 12px; border-radius: 12px; color:#000; font-family: Arial, Helvetica, sans-serif; top:85%; left:30%; z-index:3}

    </style>

    <script src="js/jqueryui/js/jquery-1.7.2.min.js"></script>
    <script src="js/jqueryui/js/jquery-ui-1.8.20.custom.min.js"></script>
    <script src="js/jqueryui/js/jquery.ui.touch-punch.min.js"></script>

    <script>
    $(function() {
        $(  #draggable  ).draggable({
        containment:  #content ,
        drag: function(event, ui){
            $( .status )
            .addClass( ui-state-highlight )
            .find( p )
                 .html( &nbsp; );
            }
        });


            $(  #droppable  ).droppable({
                accept:  #draggable ,
                drop: function( event, ui ) {
                    $.this.css({ background : white });
                    $( .status )
                    .addClass( ui-state-highlight )
                        .find( p )
                            .html( Good! );
                             }
                    });
            });
    </script>

</head>

<body>
    <div class="content">

      <img class="base"src="images/base.png" />

      <div id="draggable" class="ui-widget-content part1">
        <img src="images/part1.png" />
      </div>

      <div id="droppable" class="ui-widget-header drop1">
        <div></div>
      </div>

      <div. class="status">
        <p>Please Assemble</p>
      </div>

     </div><!-- /content -->

</body>
问题回答

这是由于适用于可赔款的<代码>margin造成的。 如果你删除这些特别安全局的声明,那么这项工作应该按预期进行。

 .part1 { margin-top:15%; margin-left:57%; }

http://bugs.jqueryui.com/ticket/6876“rel=“nofollow”http://bugs.jqueryui.com/ticket/6876





相关问题
Mysql trigger/events vs Cronjob

I have an auction website which let my users place an unlimited amount of autobiddings. To monitor these autobiddings something has to check the database every second. My question is if it is ...

Can an event be used as an event listener?

I m trying to expose some events from a private object which is contained inside the object I am creating and it looks like the compiler is happy with this: private WindowUpdateServer ...

鸡奸

由于将javascript DOM方法放在第html页底部(在<有人>之后)远比利用“j Query”准备活动要快得多,因此我们不得不这样做:

Attaching a property to an event in Flex/AS3

I have a parameter that needs to be passed along with an event. After unsuccessful attempts to place it on the type by extending the class, I ve been advised in another SO question to write a custom ...

jQuery bind on ajax load() event

I have a page which displays multiple blocks with results details. Inside each block I have some <a> tags with thickbox jQuery plugin attached: class="thickbox" Here is an example of one kind ...

HTML text input event

I have a form, and want to disable/enable its submit button depending on whether the form s input text fields are empty or have had text entered into them. I think this means having an event handler ...

IE doesn t run Javascript when you click back button

I ve built a shop with tons of JS running. One of the pieces of the cart, is a zip code field which is required to calculate shipping cost. This works fine going through the cart. Now clicking ...

热门标签