Forums

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

Home Forums JavaScript Why is my very basic jQuery code not working? :/

  • This topic is empty.
Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #33905
    Ash149
    Participant

    Hello all!

    So i’m trying to write my first bit of jQuery to do something on a site and I’m sure I could probably copy some code to do it but I want to do it myself, I’ve been watching lots of jQuery tutorials (just watching the first one on here that Chris did) and basically I can’t seem to get my coding working correctly.

    Here is the code I’ve written:




    That’s exactly how it is in my header section on the site. Basically trying to get it to change the ‘top’ of the media-bar, here is the HTML:




    This is the media bar

    This is another line.

    This is yet another line of text.



    The CSS for the media bar is as follows:


    #media-bar {
    width:100%;
    height:200px;
    background:yellow;
    position:fixed;
    max-height:200px;
    top:-200px;

    }

    It’s basically hidden from the page. If I change the #media-bar ‘top’ to 0px it displays where I want it to once you have clicked the ‘start here’ div. If you get what I mean. I can’t see why it shouldn’t be working?

    Thanks a lot if anyone can help!

    Ash

    #84993
    Ash149
    Participant

    Thanks fourize, the code you supplied worked fine, I used to it add a top value to the start-here DIV to move that down 200px.

    Though the only way I could get it working properly was to use the mouseover the header and page-wrap so put it back away, but that’s ok for now, I’m gonna watch some more tutorials/read up on jQuery as I need to be able to do this kinda stuff properly, but for now my code will work ok, this is what the jQuery ended up being like:

    So for now that will have to suffice :)

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