Grow your CSS skills. Land your dream job.

Problems pointing to files on my server

  • # November 20, 2012 at 8:43 pm

    I’m having some difficulty pointing to one of my js files on my server.

    I have a pretty standard set up,

    - **index.html**
    - **js folder**
    - **css folder**

    The difficulty is i have another folder called

    - **6_toggle**

    Within this folder i have six html files named 1.html,** 2.html, etc. I need these individual files to point to a file in my js folder

    I thought it would be,

    I’ve also tried,

    But it doesn’t seem to work.

    Would anyone have any ideas on how to fix this?ix this?

    # November 20, 2012 at 9:14 pm

    That last go around should have worked, is there a way we could see the directories?

    # November 20, 2012 at 10:40 pm

    If possible (and it usually is, unless this is for a code package you intend to distribute), I’d recommend using root-relative URLs instead:

    `/js/view.min.js?auto`

    # November 21, 2012 at 3:42 am

    @matt_sanford Sure, here’s a [link](http://orchidaberdeen.com/ “”) to the site

    @traq sorry but i’m not sure what you mean.

    # November 21, 2012 at 3:49 am

    @CameronDuthie

    @traq is basically saying use URL’s that are relative to the root of you website folder, so instead of linking to your js file like this;

    ../js/view.min.js?auto

    Link to it like this;

    /js/view.min.js?auto

    Without the dots before the forward slash…

    # November 21, 2012 at 3:56 am

    @Watson90 Hey man, thanks responding but i can’t seem to see the code you’ve posted.

    # November 21, 2012 at 4:01 am

    It’s because I put src=’path-to-file’, I don’t think it likes it when you do that.

    # November 21, 2012 at 4:16 am

    @CameronDuthie – whis is the script path ending in ‘?auto’ shouldn’t it just be ‘view.min.js’?

    # November 21, 2012 at 5:04 am

    @Watson90 It can be both. It’s a jQuery plugin developed by [Rogie King](http://finegoodsmarket.com/view/ “”) and it says the quickest and simplest way to get it up and running is to add it with the ?auto at the end.

    Just tried it without the dots and still nothing.

    Am i right in thinking i need to reference this script in my index.html and in each html file in my 6_toggle folder?

    # November 21, 2012 at 10:04 am

    This is the latest.

    It works perfectly [here](http://orchidaberdeen.com/6_toggle/1.html “”),

    But once it get’s pulled into the [index.html](http://orchidaberdeen.com/ “”) it doesn’t want to work.

    So strange and i’m officially out of ideas…

    # November 21, 2012 at 10:13 am

    How does it get “pulled into the index.html” ?

    # November 21, 2012 at 10:15 am

    …and what is it supposed to do?

    # November 21, 2012 at 10:30 am

    @pmac627 The files in the _6_toggle_ folder get pulled through by jQuery.

    @Paulie_D It’s supposed display as a lightbox effect there’s an example of it [here](http://finegoodsmarket.com/view/ “”)

    And it works perfectly in their individual files, http://orchidaberdeen.com/6_toggle/1.html

    but when the 1.html, 2.html, etc get called through into index.html it doesn’t want to work.

    It get’s pulled through for the gallery section, http://orchidaberdeen.com/#gallery

    any thoughts or suggestions would be greatly appreciated.

    # November 21, 2012 at 10:37 am

    Then I’m forced to think that the way you are bringing in the content it is fundamentally inconsistent with what the JS actually does.

    Of course, I know nothing of JS.

    # November 21, 2012 at 10:41 am

    Would pulling the files via jQuery trigger the browser to request the js files at all? I don’t know enough about jQuery ajax calls to know. However, if it is requesting the js files when you use jQuery to request the 1.html, I would guess it is then looking for the JS file relative to where you pulled the file to, not from where the file actually sits. Try absolute links to the js files.

Viewing 15 posts - 1 through 15 (of 19 total)

You must be logged in to reply to this topic.

*May or may not contain any actual "CSS" or "Tricks".