Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums JavaScript Better Approach To This Code?

  • This topic is empty.
Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #159142
    Steven Morgan
    Participant

    I am a javascript nube. I am wanting these brackets to slide out and wrap the word on hover. Then off hover collapse down to their original state.

    Better cross-browser approach?
    http://codepen.io/anon/pen/afjHh

    Thanks for the help!

    #159178
    JosephMalenkov
    Participant

    I’d do it with CSS. Something like this..

    <span>CUBIX</span>
    
    h2#title { font-family: 'Arial'; font-size: 32px; }
    
    h2#title::before { content: "["; padding-right: 1.5em; }
    
    h2#title::after { content: "]"; padding-left: 1.5em; margin-left: -5.6em; transition: margin-left 1.5s ease; }
    
    h2#title:hover::after { margin-left:0; } 
    
    #159192
    Rugg
    Participant

    Try this working sample: http://jsfiddle.net/6GEgF/

Viewing 3 posts - 1 through 3 (of 3 total)
  • The forum ‘JavaScript’ is closed to new topics and replies.