Forums

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

Home Forums CSS How do i apply this javascript code to this navigation?

  • This topic is empty.
Viewing 15 posts - 1 through 15 (of 15 total)
  • Author
    Posts
  • #41960
    Anonymous
    Inactive

    I’m not all that experienced with javascript and i would like to know how can i apply this javascript code.

    to the header navigation bar of this pen? [http://codepen.io/Jarolin/pen/iHCzc](http://codepen.io/Jarolin/pen/iHCzc “”)

    The source and use of the javascript code can be found here [http://www.metaltoad.com/blog/resizing-text-fit-container](http://www.metaltoad.com/blog/resizing-text-fit-container “”)

    #125722
    chrisburton
    Participant

    `elem` represents to replace that with an actual element.

    #125723
    Anonymous
    Inactive

    @chrisburton I’ve already tried that and tried it again but there was no change.

    #125724
    chrisburton
    Participant

    Where are you loading jQuery? Why isn’t the javascript in the javascript panel?

    You might want to rethink some of your markup as well. Using `
    ` tags to separate content is pointless when you could just use a block level element (such as a `p` tag).

    #125725
    Anonymous
    Inactive

    I also updated the pen and included the javascript code. I basically want the navigation link to fill the entire width of the header div automatically. And shrink automatically when it overflows.

    #125728
    Anonymous
    Inactive

    @chrisburton I got rid of that on my original html code. that code is from a few days ago. But how do i apply the javascript? also i dont know what you mean by> Where are you loading jQuery? Why isn’t the javascript in the javascript panel?

    #125731
    chrisburton
    Participant

    @Jarolin Please take some time to read this: https://css-tricks.com/forums/discussion/comment/87079

    #125734
    Anonymous
    Inactive

    @chrisburton i don’t see what it is your asking me to do. The javascript code is in the pen.

    #125741
    chrisburton
    Participant

    If you’ve read the link above, I was teaching you how to use CodePen properly.

    #125748
    Anonymous
    Inactive

    @CrocoDillon there is a change but the text remains the same size even when it overflows the header. I want the text to automatically shrink to the proper size to prevent it from overflowing.

    #125752
    Anonymous
    Inactive

    @CrocoDillon i updated the pen with the changes you provided.

    #125753
    chrisburton
    Participant

    It’s because he isn’t properly using CodePen. Remove the script tags at the beginning and end of the code on the JS panel. Then, click on the sprocket button on the JS panel next to the number (top right corner) and choose jQuery on the dropdown. Done.

    http://cloud.chrisburton.me/N8sH

    #125754
    Paulie_D
    Member

    Could someone please provide a link to the latest good Pen?

    #125755
    chrisburton
    Participant

    @Paulie_D It’s the link on his first post. If you changed some stuff and it isn’t updating, go to his profile and click on the pen we’re working on (last page).

    #125757
    Anonymous
    Inactive

    @chrisburton I made those changes and it works now. Thank you.


    @CrocoDillon
    thank you for your help also.

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