Note that there are some explanatory texts on larger screens.

plurals
  1. PO180 degree rotated div is only clickable from one side
    primarykey
    data
    text
    <p>I've run into a rather strange problem. I have a div that is rotatable via CSS3. The div has a front div child and back div child, with the back div having <code>-webkit-transform: rotateY( 180deg )</code> set.</p> <p>The problem that once the parent element is rotated to display the back side of the div, it will only detect clicks of child elements on exactly one side of the div, specifically the second half of the div or right side. The front side div detects clicks on the entire face of element. Also, the z-indexes are fine. I assume that the issue may be due to the rotation and the browser displaying one half of the side "closer"? </p> <p>The code that this is breaking is extremely complex, so I created a test file to demonstrate the problem below. I'm using a jQuery plugin I wrote for the 3D transformations, which can be found here <a href="https://github.com/pwhisenhunt/jquery.transform/blob/master/jquery.transform.js" rel="nofollow">https://github.com/pwhisenhunt/jquery.transform/blob/master/jquery.transform.js</a>.</p> <p><strong>Edit:</strong> After experimentation, the clicking of the button element is only registering from 100-200px and not from 0-100px. In other words, it is in fact only registering on the second half of the div.</p> <p>Any help is very much appreciated!</p> <pre><code>&lt;html&gt; &lt;head&gt; &lt;style&gt; .element{ width:200; height:200; -webkit-perspective: 800; -webkit-transform-style: preserve-3d; } .element figure { display: block; height: 100%; width: 100%; position: absolute; -webkit-backface-visibility: hidden; border:1px solid yellow; } .element .front { -webkit-border-radius:8px; padding: 0px; margin: 0px; background-color:yellow; z-index: 9870; } .element .back { -webkit-border-radius:8px; padding: 0px; margin: 0; -webkit-transform: rotateY( 180deg ); z-index: 0; border: 1px solid red; background-color:green; } &lt;/style&gt; &lt;script src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"&gt;&lt;/script&gt; &lt;script src="https://raw.github.com/pwhisenhunt/jquery.transform/master/jquery.transform.js"&gt;&lt;/script&gt; &lt;script&gt; $(function(){ var temp = false; $(".element").click(function(){ if(temp == false){ $(this).transform("setAnimationDuration", 1).transform("rotateY", 180); $(this).unbind("mouseenter mouseleave"); button = $(document.createElement('div')).attr("id", "button").css({ width: 200, height: 50, backgroundColor:"blue" }); button.click(function(){ console.log("Clicking"); }); temp = true; $(this).append(button); } }) }) &lt;/script&gt; &lt;/head&gt; &lt;body&gt; &lt;div class="element"&gt; &lt;figure class="front"&gt;&lt;/front&gt; &lt;figure class="back"&gt;&lt;/front&gt; &lt;/div&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p><strong><a href="http://jsfiddle.net/7AbWe/" rel="nofollow">A JSFiddle Example of the Problem - Can be found HERE!</a></strong></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.
 

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