小编nyr*_*s91的帖子

如何在javascript中将鼠标悬停在矩形上?

我在屏幕上创建了一个矩形,我想在鼠标悬停时在矩形上显示一些按钮.但我无法处理这项工作.我的代码如下.我无法理解为什么

这$( '控制 ')removeClass(' 隐藏').

这一行不起作用.它也没有给出任何错误.

$(this.rect).html(................ ........ css({position:'absolute',padding:'10px'});

我也无法理解我的这部分代码.(堆栈不允许div.我不知道为什么).谢谢.

var KineticModel = Backbone.Model.extend({
    myRect: null,

    createRect : function() {
            alert("rectangle created.");
            var rect=new Kinetic.Rect({
                            x: 50,
                            y: 50,
                            width: 150,
                            height: 150,
                            fill: 'green',
                            stroke: 'black',
                            strokeWidth: 1,
                            offset: [0, 0],
                            draggable: true,
                      });
            rect.on("mouseover",function(){
                alert("Hoover : ");
                $('.control').removeClass('hide');
            });
            rect.on("mouseout",function(){
                alert("Out : ");
            });
            rect.on("mousedown",function(){
                alert("Down : ");
            });
            rect.on("mouseup",function(){
                alert("Up : ");
            });
            return rect;
        }
});

var KineticView = Backbone.View.extend({
        tagName: 'span',
        stage: null,
        layer: null, …
Run Code Online (Sandbox Code Playgroud)

javascript javascript-events backbone.js kineticjs

4
推荐指数
1
解决办法
287
查看次数