The Lodge is members-only design/dev videos and Office Hours.

Next Office Hours Session: "Implementing an SVG Icon System" Nov 30 - 6:00 PM Eastern

Javascript not working please help

  • # July 13, 2013 at 2:43 am

    So I’ve got a small issue,

    I’ve recently made my website responsive. I’ve gone with the one page idea.

    and now I found that I want as much time on my site as possible, I want to try using 3rd party sites as little as possible so i have decided to post my “example snippets” on my own site, each has a page, and each of the pages has their own containing DIV with the ID of the title in the name so the CSS doesn’t get mixed up. which i found to be working. but keeping in mind that there are jQuery and JS scripts incorperated into these examples. and their all being dumped on one java script file, i found that only ONE of them work. I dont know why the other don’t work.

    I’m also using examples/ as a blank page and having that as the parent page (for the url structure) I’m not sure if that’s the way to do it, but It seems to work for me.

    Also here’s the link to my JS File

    # July 13, 2013 at 11:11 pm

    This reply has been reported for inappropriate content.

    you guys got nothing?

    # July 14, 2013 at 8:03 am

    This reply has been reported for inappropriate content.

    Without having looked at the problem yet. Why not embed the JS for each page in the HTML? External JS is good because it’s cached, re-used on different pages and all, but here the JS is small so you don’t really need caching and it’s nor re-used either since they are examples.

    Speaking of caching, don’t use “. Link to the precise version you want to benefit from long term caching (assuming jQuery CDN works the same as Google’s).

    EDIT: Anyway, you’re getting errors because in your JS you assume some elements exists, but they don’t exist on all pages.

    # July 14, 2013 at 11:03 am

    This reply has been reported for inappropriate content.

    For the javascript insert code. does it not need to be in the head tag of each page? if i’m using WORD PRESS i can’t change that for each page..

    [updated] nevermind i got that answered..

    but still the code isn’t working

    # July 14, 2013 at 11:40 am

    This reply has been reported for inappropriate content.

    Okay so i’ve moved all the js to its seperate page and updated the jquery library to newest version.

Viewing 5 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic.

There's a whole bunch of content on CSS-Tricks.

Search for Stuff   •   Browse the Archives

Get the Newsletter ... or get the RSS feed