Mootoolsの「TheWall」プラグインを使用してイメージウォールを作成しています。initWall()で問題なく作成されますが、画像を「a」タグでラップすると、ドラッグが終了した後、リンクをクリックして、クリックしていなくてもhrefに移動します。 。これが私のコードです
window.addEvent("domready", function() {
new Wall("wall", {
width: 260,
height: 180,
rangex: [-10,10],
rangey: [-10,10],
inertia: true,
callOnUpdate: function(items) {
items.each(function(item) {
var a=new Element("a",{
href:"post.php",
styles: {
opacity: 0
}
});
var img=new Element("img",{
src:"img/260x180.gif"
});
img.inject(a);
a.inject(item.node).fade(1);
});
}
}).initWall();
});
結果のHTMLはこれです
<div class="tile" col="-1" row="-1" rel="-1x-1" style="position: absolute; left: -260px; top: -180px; width: 260px; height: 180px; ">
<a href="post.php" style="visibility: visible; zoom: 1; opacity: 1; ">
<img src="img/260x180.gif">
</a>
</div>
アイテム自体を最も外側のクラスとして作成するにはどうすればよいですか。アイテムは次のようになります。
<a href="post.php" class="tile" col="-1" row="-1" rel="-1x-1" style="position: absolute; left: -260px; top: -180px; width: 260px; height: 180px; ">
<img src="img/260x180.gif">
</a>
更新: OKと答えました。自分でそれを理解しました。「クリック」イベントハンドラーを追加し、getMovement関数を使用する必要があります。
a.addEvent("click",function(e){
if( wall.getMovement() ){
e.stop();
}
});