我做了一个照片概念的演示,它在两张图像之间切换以显示它们之间的差异。
我有一个工作正常的 onMouseClick 事件,除了在 iPad 上。响应在我的桌面上是即时的,但在平板电脑上却相当延迟,可能是 500 毫秒?
这是正常的吗?我还有其他方法可以处理这个吗?
Javascript:
var img1 = new Image();
img1.src = "http://watkinsfilm.com/wp-content/uploads/2012/09/19mm.jpg";
var img2 = new Image();
img2.src = "http://watkinsfilm.com/wp-content/uploads/2012/09/200mm.jpg";
function test() {
if (document.pic.src == 'http://watkinsfilm.com/wp-content/uploads/2012/09/19mm.jpg') {
document.pic.src = 'http://watkinsfilm.com/wp-content/uploads/2012/09/200mm.jpg';
}
else if (document.pic.src == 'http://watkinsfilm.com/wp-content/uploads/2012/09/200mm.jpg') {
document.pic.src = 'http://watkinsfilm.com/wp-content/uploads/2012/09/19mm.jpg';
}
}
身体:
<div>
<table id="table-1" >
<tr><td>
<img id="img" src="http://watkinsfilm.com/wp-content/uploads/2012/09/19mm.jpg" name="pic" onMouseDown="test()"/>
<img id="png1" src="http://www.thedigitaltrekker.com/wp-content/uploads/2012/03/logo-6smA.png"/>
Click on the image above to toggle between 19mm and 200mm <br>
</td></tr>
</table>
</div>
同样在 jsfiddle:http: //jsfiddle.net/ntmw/R4pey/5/