Results 1 to 2 of 2

Thread: Link text roll animation

  1. #1
    Join Date
    Sep 2012
    Posts
    13
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Lightbulb Link text roll animation

    I found this script on jsfiddle and wanted to implement it on my site.

    This is the script:

    http://jsfiddle.net/hakim/Ht6Ym/

    Unfortunately the animation doesn't display at all as you can see on the site: http://goo.gl/ImCUJ. Any suggestions?

    Thanks

  2. #2
    Join Date
    Dec 2008
    Location
    Portsmouth, UK
    Posts
    1,891
    Thanks
    2
    Thanked 441 Times in 435 Posts

    Default

    I can not find the script on your page

    but as written it must go immediately before the </body> tag
    + the script is not XBrowser

    Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    
    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
    
    <head>
      <title></title>
    <style type="text/css">
    /*<![CDATA[*/
    body {
        font-family: sans-serif;
        background: #333;
        color: #eee;
    }
    
    a {
        text-decoration: none;
        color: hsl(206, 80%, 50%);
    }
    
    .roll {
        display: inline-block;
        overflow: hidden;
    
        vertical-align: top;
    
        -webkit-perspective: 400px;
           -moz-perspective: 400px;
    
        -webkit-perspective-origin: 50% 50%;
           -moz-perspective-origin: 50% 50%;
    }
    .roll span {
        display: block;
        position: relative;
        padding: 0 2px;
    
        -webkit-transition: all 400ms ease;
           -moz-transition: all 400ms ease;
    
        -webkit-transform-origin: 50% 0%;
           -moz-transform-origin: 50% 0%;
    
        -webkit-transform-style: preserve-3d;
           -moz-transform-style: preserve-3d;
    }
        .roll:hover span {
            background: #111;
    
            -webkit-transform: translate3d( 0px, 0px, -30px ) rotateX( 90deg );
               -moz-transform: translate3d( 0px, 0px, -30px ) rotateX( 90deg );
        }
    .roll span:after {
        content: attr(data-title);
    
        display: block;
        position: absolute;
        left: 0;
        top: 0;
        padding: 0 2px;
    
        color: #fff;
        background: hsl(206, 80%, 30%);
    
        -webkit-transform-origin: 50% 0%;
           -moz-transform-origin: 50% 0%;
    
        -webkit-transform: translate3d( 0px, 105%, 0px ) rotateX( -90deg );
           -moz-transform: translate3d( 0px, 105%, 0px ) rotateX( -90deg );
    }
    /*]]>*/
    </style>
    
    
    </head>
    
    <body>
    <h1>
        <a href="http://slipsum.com/">Samuel L Ipsum</a>
    </h1>
    
    <p>Wanted to spice up the links around <a href="http://hakim.se">my site</a> and ended up re-creating this over-the-top Flash classic.</p>
    
    <p>Do you see any <a href="http://pbskids.org/teletubbies/">Teletubbies</a> in here? Do you see a slender <a href="http://en.wikipedia.org/wiki/Plastic">plastic</a> tag clipped to my shirt with my name printed on it? Do you see a little Asian child with a blank expression on his face sitting outside on a <a href="http://en.wikipedia.org/wiki/Helicopter">mechanical helicopter</a>that shakes when you put quarters in it? No? Well, that's what you see at a toy store. And you must think you're in a toy store, because you're here shopping for an infant named Jeb.</p>
    
    <p>Well, the way they make shows is, they make one show. That show's called a <a href="http://en.wikipedia.org/wiki/Television_pilot">pilot</a>. Then they show that show to the people who make shows, and on the strength of that one show they decide if they're going to make more shows. Some pilots get picked and become <a href="http://en.wikipedia.org/wiki/Television_program">television programs</a>. Some don't, become nothing. She starred in one of the ones that became nothing.</p>
    <script  type="text/javascript">
    /*<![CDATA[*/
    var supports3DTransforms =  document.body.style['webkitPerspective'] !== undefined ||
                                document.body.style['MozPerspective'] !== undefined;
    
    function linkify( selector ) {
        if( supports3DTransforms ) {
    
            var nodes = document.querySelectorAll( selector );
    
            for( var i = 0, len = nodes.length; i < len; i++ ) {
                var node = nodes[i];
    
                if( !node.className || !node.className.match( /roll/g ) ) {
                    node.className += ' roll';
                    node.innerHTML = '<span data-title="'+ node.text +'">' + node.innerHTML + '</span>';
                }
            };
        }
    }
    
    linkify( 'a' )
    /*]]>*/
    </script>
    </body>
    
    </html>
    Vic
    God Loves You and will never love you less.
    http://www.vicsjavascripts.org/Home.htm
    If my post has been useful please donate to http://www.operationsmile.org.uk/

Similar Threads

  1. Roll over image link pop up on click?
    By bluraja in forum Dynamic Drive scripts help
    Replies: 3
    Last Post: 11-07-2011, 02:04 PM
  2. Animation when a link is clicked
    By Wimpie in forum JavaScript
    Replies: 0
    Last Post: 10-10-2007, 07:17 AM
  3. Pop-up text box/Roll over image
    By vik101 in forum Looking for such a script or service
    Replies: 0
    Last Post: 08-29-2007, 02:13 AM
  4. Image Roll-Over with Drop-Down (Pop-Out) Text Menu
    By SydsEastside in forum Looking for such a script or service
    Replies: 0
    Last Post: 01-16-2007, 07:33 PM
  5. text animation css problem
    By moscarda in forum CSS
    Replies: 1
    Last Post: 09-22-2005, 05:30 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •