Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I currently work with canvas speech balloons. But because the balloon with the pointer is wrapped in a div, some links under it aren't click able anymore. I cant use extjs in this case. <a href="http://www.meindesign.net/tools/querstion3.php" rel="noreferrer">See basic example for my speech balloon tutorial</a> <strong>requires HTML5</strong> </p> <p>So I decided to collect all link coordinates from inside the balloons in an array.</p> <pre><code>var clickarray=[]; function getcoo(thatdiv){ thatdiv.find(".link").each(function(){ var offset=$(this).offset(); clickarray.unshift([(offset.left), (offset.top), (offset.left+$(this).width()), (offset.top+$(this).height()), ($(this).attr('name')), 1]); }); } </code></pre> <p>I call this function on each (new) balloon. It grabs the coordinates of the left/top and right/down corners of a link.class - additionally the name attribute for what to do if someone clicks in that coordinates and I loved to set a 1 which means that it wasn't clicked jet. And unshift this array to the clickarray. You could use push too.</p> <p>To work with that array:</p> <pre><code>$("body").click(function(event){ event.preventDefault();//if it is a a-tag var x=event.pageX; var y=event.pageY; var job=""; for(var i in clickarray){ if(x&gt;=clickarray[i][0] &amp;&amp; x&lt;=clickarray[i][2] &amp;&amp; y&gt;=clickarray[i][1] &amp;&amp; y&lt;=clickarray[i][3] &amp;&amp; clickarray[i][5]==1){ job=clickarray[i][4]; clickarray[i][5]=0;//set to allready clicked break; } } if(job.length&gt;0){ // --do some thing with the job -- } }); </code></pre> <p>This function proofs the coordinates of a body click event or whether it was already clicked and returns the name attribute. I think it is not necessary to go deeper, but you see it is not that complicate. Hope in was enlish...</p>
    singulars
    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.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      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