jQueryUI的可拖动的不是在IE工作?(JqueryUI Draggable not worki

2019-10-17 03:44发布

我使用jQueryUI的帮助与此页面上的活动项目:

http://www.hiredavewaring.com

如果向下滚动,你会看到PNG的,你可以抓住并移动了我的脸来创建一个PotatoHead先生式的效果。

我知道这是不是世界上最漂亮的代码,但它除了上的Internet Explorer浏览器的每一个伟大的工作。

有谁知道一个修复,以帮助这些项目在IE中成为可拖动?

这里有没有谷歌Analytics(分析)或Meta代码:

<link rel="stylesheet" type="text/css" href="css/swagger.css" />

<!-- Draggable Pics -->
<script type="text/javascript"
    src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
<script type="text/javascript"
    src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.2/jquery-ui.js"></script>
<link rel="stylesheet" type="text/css"
    href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.1/themes/base/jquery-ui.css"/>
<!-- end Draggable Pics -->

</head>

<body>

<div id="wrapper3">

  <div id="coverleftside1">
        <div id="dave3">
        <img src="images/dave3.png" alt="David Lee Waring, a Graphic and Web Designer in Orlando, FL">
        </div>
  </div>
    <div id="coverrightside1">

    </div>
    <div class="clear">
    </div>
    <div id="sig">
    <img src="images/logo2.png" alt="David Lee Waring, a Graphic and Web Designer in Orlando, FL">
    </div>
    <div id="nav3">
    <ul>
            <li><a href="http://www.hiredavewaring.com/index.html" >Home</a></li>
            <li><a href="http://www.hiredavewaring.com/about.html"  >About</a></li>
            <li><a href="http://www.hiredavewaring.com/design.html" >Portfolio</a></li>
            <li><a href="http://www.hiredavewaring.com/contact.html"  >Contact</a></li>
            <li><a href="http://www.hiredavewaring.com/blog" >Blog</a></li>
      </ul>
    </div>
    <p>Grafiti Time!  Click on an image below and drag it over Dave's face. Send us a screen shot of your favorite combination.</p>
    <a href="http://www.hiredavewaring.com"> Click Here to reset and start over. </a>
<div class="draggable">   
<div class="demo"><img src="images/funnyface/glassesnose.png" alt="Move me over Dave's Face!" ></div>
<div class="demo2"><img src="images/funnyface/beard1.png" alt="Move me over Dave's Face!" ></div>
<div class="demo3"><img src="images/funnyface/beard2.png" alt="Move me over Dave's Face!" ></div>
<div class="demo4"><img src="images/funnyface/beard3.png" alt="Move me over Dave's Face!" ></div>
<div class="demo5"><img src="images/funnyface/must1.png" alt="Move me over Dave's Face!" ></div>
<div class="demo6"><img src="images/funnyface/must2.png" alt="Move me over Dave's Face!" ></div>
<div class="demo7"><img src="images/funnyface/eyesangry.png" alt="Move me over Dave's Face!" ></div>
<div class="demo8"><img src="images/funnyface/eyescross.png" alt="Move me over Dave's Face!" ></div>
<div class="demo9"><img src="images/funnyface/eyesgoogle.png" alt="Move me over Dave's Face!" ></div>
<div class="demo10"><img src="images/funnyface/eyesscared.png" alt="Move me over Dave's Face!" ></div>
</div> 
<SCRIPT>
$(function(){
    $('.demo')
        .draggable();
});
$(function(){
    $('.demo2')
        .draggable();
});
$(function(){
    $('.demo3')
        .draggable();
});
$(function(){
    $('.demo4')
        .draggable();
});
$(function(){
    $('.demo5')
        .draggable();
});
$(function(){
    $('.demo6')
        .draggable();
});
$(function(){
    $('.demo7')
        .draggable();
});
$(function(){
    $('.demo8')
        .draggable();
});
$(function(){
    $('.demo9')
        .draggable();
});
$(function(){
    $('.demo10')
        .draggable();
});
</SCRIPT>
<!-- End Draggable -->

</div>

</body>
</html>

谢谢,戴夫

Answer 1:

首先,我会限制你的代码到一个单一的$(function(){});

$(function(){
    $('.demo').draggable();
    $('.demo2').draggable();
    $('.demo3').draggable();
    $('.demo4').draggable();
    $('.demo5').draggable();
    $('.demo6').draggable();
    $('.demo7').draggable();
    $('.demo8').draggable();
    $('.demo9').draggable();
    $('.demo10').draggable();
});

更重要的是, draggable 需要的jQuery UI 1.8.6或更高版本的IE9工作。 还有一个补丁适用于旧版本,但我真的建议升级。



文章来源: JqueryUI Draggable not working in IE?