我正在使用JQueryUI来帮助处理此页面上的可移动项目:
如果你向下滚动,你会看到你可以抓住并在我脸上移动的png,以创建一个Mr. PotatoHead类型的效果。
我知道这不是世界上最漂亮的代码,但除了Internet Explorer之外,它在每个浏览器上都运行良好。
有没有人知道帮助这些项目在IE中变得可拖动的修复程序?
以下是没有Google 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>
谢谢, 戴夫
答案 0 :(得分:3)
首先,我会将您的代码限制为单个$(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中运行。还有一个patch可用于旧版本,但我真的建议升级。