javascript - Implementing a hover info box -


i have calendar, , when user hovers on cell, large-ish info box appears details date. having trouble though making info box disappear when user moves away.

i want when mouse cursor moves out of calendar cell hidden info box disappear. i'm having trouble because mouseenter , mouseleave messed having info box top element.

so tried around using "placeholder" divs transparent, have same shape , location calendar cell beneath it, , have z-index of 1000 above info box. apply mouseenter , mouseleave events these divs instead.

there's 2 problems though. one, have messed html semantically. divs have no purpose around seems limitation. , secondly, mess jquery ui selection (i've applied calendar cells - click no longer selects cell).

is there clean way handle displaying info box? there no user interaction info box -- it's display information.

edit: here code:

<li>     <div class="day-content">     </div>     <div class="day-content-placeholder">     </div> </li> 

and css

li     { position: absolute; width: 15%; height: 20%; top: ... left: ... } .day-content     { position: absolute; width: 100%; height: 100%; } .day-content-placeholder     { position: absolute; width: 100%; height: 100%; z-index: 1000; } .popup     { position: absolute; width: 300%; height: 300%; left: -150%; top: -150%; z-index: 500; } 

and javascript

var popup; $('.week-content-placeholder')     .mouseenter(function()         {         popup = $('<div class="popup">'+a_lot_of_text+'</div>').insertafter(this);         })     .mouseleave(function()         {         popup.remove();         }); 

that's not exact code, idea. works okay, said, since .week-content-placeholder above .week-content, selection capability jquery ui doesn't work on .week-content.

you modify solution transparent "placeholder" divs in following way:

have "placeholder" dive underneath "calendar cell", using {zindex: -1}.

when enter calendar cell, unhide large "content" div , set {zindex: 1000} on "placeholder" div bring top.

have "mouseout" event on placeholder div hide "content" div , set {zindex: -1} the "placeholder" cell.

rather create "placeholder" cells in html, create 1 in javascript , move postion of each "calendar" cell "mousein" it. duplicate "click" events on "calendar cell" onto 1 well.

let me know if works.


Comments

Popular posts from this blog

java - SNMP4J General Variable Binding Error -

windows - Python Service Installation - "Could not find PythonClass entry" -

Determine if a XmlNode is empty or null in C#? -