【问题标题】:change top position for mousemove() container with jquery使用 jquery 更改 mousemove() 容器的顶部位置
【发布时间】:2012-08-20 08:08:39
【问题描述】:

谁能帮助告诉我如何更改此鼠标移动容器的 y 位置。

container.find(".item_over").mousemove(function(e) { 
        var offset = container.offset();
        x = e.pageX - offset.left;
        var currentZone = Math.floor(x / zoneWidth);
        $(this).find("li").css("display", "none"); 
        $(this).find("li:eq(" + currentZone + ")").css("display", "block"); 
    }); 

谢谢大家

【问题讨论】:

  • 你喜欢做什么?鼠标光标后垂直移动容器?

标签: jquery html containers mousemove


【解决方案1】:
container.find(".item_over").mousemove(function(e) { 
    var offset = container.offset(),  //comma to seperate variables
        x = e.pageX - offset.left, 
        y = e.pageY - offset.top, //gets Y, not sure how you intend to use it ??
        currentZone = Math.floor(x / zoneWidth);

    $(this).find("li").css("display", "none"); 
    $(this).find("li:eq(" + currentZone + ")").css("display", "block"); 
}); ​

【讨论】:

    猜你喜欢
    • 2021-09-29
    • 1970-01-01
    • 1970-01-01
    • 2014-05-22
    • 1970-01-01
    • 2011-10-21
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多