Note that there are some explanatory texts on larger screens.

plurals
  1. POjquery image hover popup cant detect browser edge and change its direction
    primarykey
    data
    text
    <p>i am trying to implement jquery image hover popup but facing a problem when the popup is closer to browser edge it goes beyond its edge i want it to change its direction when it finds that space is not enough to show that popup, i have see this effect in many plugins where popups, tooltips and drop down menus change their direction if they are close to browser window edge</p> <p>can any one guide me in right direction <strong>here is the screen shot for reference</strong> <a href="http://img512.imageshack.us/img512/4990/browseredge.png" rel="nofollow noreferrer">http://img512.imageshack.us/img512/4990/browseredge.png</a></p> <p><strong>here is the jquery hover code</strong></p> <pre><code>function imagePreview(){ /* CONFIG */ xOffset = 10; yOffset = 30; // these 2 variable determine popup's distance from the cursor // you might want to adjust to get the right result /* END CONFIG */ $("a.preview").hover(function(e){ this.t = this.title; this.title = ""; var c = (this.t != "") ? "&lt;br&gt;" + this.t : ""; var newName = this.name; //console.log(this.name); newName=newName.replace("/l/","/o/"); //console.log(newName); $("body").append("&lt;p id='preview'&gt;&lt;img src='"+ this.name +"' alt='Image preview' style='margin-bottom:5px;'&gt;"+ c +"&lt;/p&gt;"); $("#preview img").error(function () { $("#preview img").attr("src" ,newName).css({'width': '400px', 'height': 'auto'}); }); $("#preview") .css("top",(e.pageY - xOffset) + "px") .css("left",(e.pageX + yOffset) + "px") .fadeIn("fast"); }, function(){ this.title = this.t; $("#preview").remove(); }); $("a.preview").mousemove(function(e){ $("#preview") .css("top",(e.pageY - xOffset) + "px") .css("left",(e.pageX + yOffset) + "px"); }); }; </code></pre> <p>any help will be appriciated</p> <p>Thanks</p> <p><strong>Salman</strong></p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload