私はmootoolsの大ファンです。しかし、mootools-snipe を jquery に移植する必要がありますが、取得できません。
私はこのコードを使用しています:
var prev_m_x = 0;
var prev_m_y = 0;
window.addEvent('mousemove',function(e){
prev_m_x=e.page.x;
prev_m_y=e.page.y;
});
Element.Events.enterfromleft ={
base: 'mouseover',
condition: function(event){
var elpos = this.getPosition();
if(prev_m_x<=elpos.x) return true; return;
}
};
Element.Events.enterfromright ={
base: 'mouseover',
condition: function(event){
var elpos = this.getPosition();
if(prev_m_x>=(elpos.x+this.getWidth())) return true; return;
}
};
私のイベントを定義します。
最後に、このイベントを次のように使用しています。
el.addEvents({
'enterfromleft':function(e){
...
},
'enterfromright':function(e){
} ...
jqueryでこのようなことをしようとしましたが、成功しませんでした。こちらをご覧ください: http://jsfiddle.net/tFw89/33/
プライベートイベントを定義するためにjqueryで何をしなければなりませんか? 事前に助けてくれてありがとう。