Hey guys im not very good with both jquery or Prototype so i started to convert the parts I know, so could 开发者_如何学运维you please do the rest and thanks guys
$(document).ready(function(){
var offsetLeft=$('menu').offsetLeft;
Event.observe('menu', 'mousemove', function(event){
coordinateX=Event.pointerX(event)-offsetLeft;
$('slider').style.marginLeft=coordinateX-20+'px';
});
});
question: can you help me with the conversion to jquery
Direct translation would be:
$(document).ready(function(){
var offsetLeft = $('#menu').offset().left;
$('#menu').bind('mousemove', function(event) {
var coordinateX = event.pageX - offsetLeft;
$('#slider').css("margin-left", (coordinateX - 20) + 'px');
});
});
Live test case.
However, you better read the documentation and understand how things work so that you can do those things on your own in the future.
精彩评论