Solved

Webkit rotateY disables all links

Posted on 2010-11-15
9
420 Views
Last Modified: 2012-05-10
I have a div. In the div is content including links. Outside of the div there's a button that rotates the page using javascript, hides the div and makes visible another div. The same button will "rotate" the page back to its original state. But, when it does, all of the links are disabled.

The javascript flips the page and it also does the hiding/revealing of the two divs. If I comment out the javascript that calls the flipping, everything is fine. So, the problem lies in the flipping (or rotating) of the page.

The code is attached below.

Is there any way to prevent the links from being disabled when implementing a webkit transition?
function flipPage()
{
    var techLinkObj = $("#techLink");
    if (techLinkObj.text() == "Technical Info")
    {        
        this.doFlipWork("180deg");
        setTimeout(function(){this.doHideShowWork("back")}, 500); // Wait .5 seconds so it appears the content is actually flipping with the page
        
    }
    else
    {
        this.doFlipWork("0deg");
        setTimeout(function(){this.doHideShowWork("front")}, 500);
    }
}

function doHideShowWork(how)
{
    var techLinkObj = $("#techLink");
    var detailsObj = $("#detailsID");
    var techObj = $("#technicalID");
    var backBtnObj = $("#nextPageBtn");
    var fwdBtnObj = $("#prevPageBtn");
    
    if (how == "back")
    {
        techLinkObj.text("Product Details"); // Change the button text
        techObj.removeClass("hidden");
        techObj.addClass("visible");
        detailsObj.removeClass("visible");
        detailsObj.addClass("hidden");
    }
    else if (how == "front")
    {
        techLinkObj.text("Technical Info"); // Change the button text
        techObj.removeClass("visible");
        techObj.addClass("hidden");
        detailsObj.removeClass("hidden");
        detailsObj.addClass("visible");
    }
}

function doFlipWork(theYRotation)
{
    var pageContentObj = $get("flipbounding"); // This is the containing div
    
    // CSS Info /////////////////////////////////////
    var theXOrigin = "50%";
    var theYOrigin = "50%";
    var theDuration = "0.80";
    var theZScale = "0";
    var theTimingFunction = "ease-in";
    ////////////////////////////////////////////////
    
    var theOrigin = theXOrigin + " " + theYOrigin;
    var theTransform = "scale(1.00) rotateX(0deg) rotateY(" + theYRotation + ") translate(0px, 0px) skew(0deg, 0deg)";
    theTransform = theTransform + " scaleZ(" + theZScale + ") rotateZ(0deg) translateZ(0px)";
    
    pageContentObj.style.webkitTransition = "-webkit-transform " + theTimingFunction + " " + theDuration + "s";
    pageContentObj.style.webkitTransformOrigin = theOrigin;
    pageContentObj.style.MozTransformOrigin = theOrigin;
    pageContentObj.style.webkitTransform = theTransform;
    pageContentObj.style.MozTransform = theTransform;
}

Open in new window

function flipPage()
{
    var techLinkObj = $("#techLink");
    if (techLinkObj.text() == "Technical Info")
    {        
        this.doFlipWork("180deg");
        setTimeout(function(){this.doHideShowWork("back")}, 500); // Wait .5 seconds so it appears the content is actually flipping with the page
        
    }
    else
    {
        this.doFlipWork("0deg");
        setTimeout(function(){this.doHideShowWork("front")}, 500);
    }
}

function doHideShowWork(how)
{
    var techLinkObj = $("#techLink");
    var detailsObj = $("#detailsID");
    var techObj = $("#technicalID");
    var backBtnObj = $("#nextPageBtn");
    var fwdBtnObj = $("#prevPageBtn");
    
    if (how == "back")
    {
        techLinkObj.text("Product Details"); // Change the button text
        techObj.removeClass("hidden");
        techObj.addClass("visible");
        detailsObj.removeClass("visible");
        detailsObj.addClass("hidden");
    }
    else if (how == "front")
    {
        techLinkObj.text("Technical Info"); // Change the button text
        techObj.removeClass("visible");
        techObj.addClass("hidden");
        detailsObj.removeClass("hidden");
        detailsObj.addClass("visible");
    }
}

function doFlipWork(theYRotation)
{
    var pageContentObj = $get("flipbounding"); // This is the containing div
    
    // CSS Info /////////////////////////////////////
    var theXOrigin = "50%";
    var theYOrigin = "50%";
    var theDuration = "0.80";
    var theZScale = "0";
    var theTimingFunction = "ease-in";
    ////////////////////////////////////////////////
    
    var theOrigin = theXOrigin + " " + theYOrigin;
    var theTransform = "scale(1.00) rotateX(0deg) rotateY(" + theYRotation + ") translate(0px, 0px) skew(0deg, 0deg)";
    theTransform = theTransform + " scaleZ(" + theZScale + ") rotateZ(0deg) translateZ(0px)";
    
    pageContentObj.style.webkitTransition = "-webkit-transform " + theTimingFunction + " " + theDuration + "s";
    pageContentObj.style.webkitTransformOrigin = theOrigin;
    pageContentObj.style.MozTransformOrigin = theOrigin;
    pageContentObj.style.webkitTransform = theTransform;
    pageContentObj.style.MozTransform = theTransform;
}

Open in new window

0
Comment
Question by:infotechelg
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 6
  • 3
9 Comments
 
LVL 44

Expert Comment

by:scrathcyboy
ID: 34141541
The rotation was designed for images, not text with links.  So I don't think you will solve it using that rotation tool.  It was not designed for links, because in order to rotate, it has to convert to graphics.
0
 

Author Comment

by:infotechelg
ID: 34141547
Sorry, don't know why the code posted twice. It won't let me edit it again.
0
 

Author Comment

by:infotechelg
ID: 34141552
Interesting. So, is there another way to handle this? Or am I just not going to be able to do this how I want?
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:infotechelg
ID: 34141576
So, how does this page, http://shauninman.com/archive/2008/07/30/v8 keep the links when the page rotates using webkitTransform?
0
 
LVL 44

Expert Comment

by:scrathcyboy
ID: 34141850
If you look at the 'links' on his page -- none of them are REAL links to files.  They just point to VIRTUAL directories.  So he is doing some real devious trickery there.  Look at the page source to learn how he has done it.  Check out the fact that he is loading fonts with javascript there too.  There is a LOT of slight of hand that has gone into his claims....
0
 

Author Comment

by:infotechelg
ID: 34146081
There's really nothing tricky about it. I was able to apply a rotate to my page instead of a 3D rotate (rotateY) and the links held. There must be something with the 3D rotate that's causing the problem.
0
 
LVL 44

Expert Comment

by:scrathcyboy
ID: 34147540
3D = Z axis
0
 

Accepted Solution

by:
infotechelg earned 0 total points
ID: 34149507
I changed the value of "var theTransform" to just "rotateY((" + theYRotation + ")" and got rid of the other CSS and it works now.
0
 

Author Closing Comment

by:infotechelg
ID: 34182471
Figrued it out on my own.
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
JQuery conflicts/syntax issue 4 24
Use "if not" in a condition 2 19
CSS for <center> 14 34
Looking for solution to pass data to 3rd-party web platform? 4 27
Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
In this tutorial viewers will learn how to style transparent/translucent elements using alpha transparency in CSS Start with a normal styled element, such as a div.: Define its "background-color" property as "rgba (255, 255, 255, .5): The numbers in…
The viewer will learn the benefit of using external CSS files and the relationship between class and ID selectors. Create your external css file by saving it as style.css then set up your style tags: (CODE) Reference the nav tag and set your prop…

749 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question