show/hide jQuery dialog box on mouseover

后端 未结 3 2066
隐瞒了意图╮
隐瞒了意图╮ 2021-01-13 12:39

I\'m trying to make a mouseover map area on an image that must display a dialog box when the mouse is over. The dialog box content is different, depending on which area it i

3条回答
  •  情书的邮戳
    2021-01-13 13:21

    Try this:

    for (var i = 0; i < 2; i++) {
        (function(i) {
            $( "#elem"+i ).mouseover(function() {
                $( ".box"+i ).dialog( "open" );
            });
    
            $( "#elem"+i ).mouseout(function() {
                $( ".box"+i ).dialog( "close" );
            });
        })(i);
    }
    

    UPDATE:

    Take a look at the demo

提交回复
热议问题