show/hide jQuery dialog box on mouseover

后端 未结 3 2029
隐瞒了意图╮
隐瞒了意图╮ 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:18

    http://jsfiddle.net/U6JGn/129/

    Modified JQuery code....

    $(document).ready(function() {
    
    
    
    for (var i = 0; i<= 1; i++) {    
    
            $( "#elem"+i ).on('mouseenter',function() {
                var st = $(this).attr('Id').replace('elem','');
                $( ".box" + st).css('display','');
            });
            $( "#elem"+i ).on('mouseout',function() {
                var st = $(this).attr('Id').replace('elem','');
                $( ".box"+st ).hide();
            });
    
        }
    
    
        });
    

提交回复
热议问题