Register

If this is your first visit, please click the Sign Up now button to begin the process of creating your account so you can begin posting on our forums! The Sign Up process will only take up about a minute of two of your time.

Results 1 to 8 of 8
Like Tree4Likes
  • 1 Post By Vapr_Arts
  • 1 Post By TheGAME1264
  • 2 Post By Ronald Roe

Thread: Is it better to have jquery library within your site or as a link?

  1. #1
    Member John Mc Grath's Avatar
    Join Date
    Sep 2011
    Location
    Ireland
    Posts
    80
    Member #
    29172
    Liked
    3 times

    Is it better to have jquery library within your site or as a link?

    Hi everyone, I am trying to create a basic tab which will contain images, text, and links. I was thinking of doing it with jquery but all the examples use links to the jquery libraries. for example
    Code:
    <link rel="stylesheet" href="http://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css" />  <script src="http://code.jquery.com/jquery-1.9.1.js"></script>
      <script src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script>
    Is this ok or is it better to contain the libraries within your site which I have been doing to now? Also do you think jquery would be best for tabs or do you have any other suggestions? Thanks for reading.
    Im pretty new to web design but I am learning fast. I will help if I can.
    Check out my sites http://www.mediareviewzone.com http://www.iamrobsmith.com

  2.  

  3. #2
    Senior Member Vapr_Arts's Avatar
    Join Date
    Oct 2013
    Location
    California
    Posts
    1,930
    Member #
    37412
    Liked
    544 times
    I know if you link it to the right place it will keep the file up to date. So when a new version of jQuery is released you will have it automatically.

    I


    Sent from my iPhone using Tapatalk
    John Mc Grath likes this.

  4. #3
    Unpaid WDF Intern TheGAME1264's Avatar
    Join Date
    Dec 2002
    Location
    Not from USA
    Posts
    14,482
    Member #
    425
    Liked
    2783 times
    Within your site. That way, you know exactly where it is and don't have to rely on an external source to serve it. This becomes an issue if a potential user can reach your site but not the external source for whatever reason.

    The tab question depends on what you're trying to accomplish.
    John Mc Grath likes this.
    If I've helped you out in any way, please pay it forward. My wife and I are walking for Autism Speaks. Please donate, and thanks.

    If someone helped you out, be sure to "Like" their post and/or help them in kind. The "Like" link is on the bottom right of each post, beside the "Share" link.

    My stuff (well, some of it): My bowling alley site | Canadian Postal Code Info (beta)

  5. #4
    Senior Member Ronald Roe's Avatar
    Join Date
    Mar 2011
    Location
    Oklahoma City
    Posts
    3,139
    Member #
    27197
    Liked
    959 times
    Regarding the "tabs" question, you'll have to elaborate. In general, tabbed interfaces don't need JS, but if you're using AJAX to bring in subsequent pages, which isn't the smartest idea in regards to search engines, then you might go with it.

    As GAME said, it's usually better to load jQuery, and all assets for that matter, from locations you control. Also, I have to recommend you not heed Vapr_Arts' advice (sorry, bruh). Version-to-version, jQuery changes. Methods are added and deprecated, and that could easily break what you've written. For instance, toggle functions. Toggle functions were deprecated in jQuery 1.8, and completely removed in 1.9. A couple of the old sites I built used them, so had I called jquery-latest from their cdn, the functions I built would have broken as soon as 1.9 was released.
    TheGAME1264 and John Mc Grath like this.
    Ron Roe
    Web Developer
    "If every app were designed using the same design template, oh wait...Bootstrap."

  6. #5
    Senior Member Vapr_Arts's Avatar
    Join Date
    Oct 2013
    Location
    California
    Posts
    1,930
    Member #
    37412
    Liked
    544 times
    I did not mean my comment as advice to use the links. I probably should have mentioned that.

    I have never thought about these types of situations because I have always preferred to have the file on my server and not use the links just because I like to remove the code I do not use. So when I go to it later I do not have to look for what I have and have not used. Not to mention the only sites I have worked on so far are for myself and are not public yet.

  7. #6
    Member John Mc Grath's Avatar
    Join Date
    Sep 2011
    Location
    Ireland
    Posts
    80
    Member #
    29172
    Liked
    3 times
    Thanks for the advice. The problem I am having is I can find nice examples of tabs using jquery that include libraries as links but I cannot find these libraries to download. I already use jquery on my site for slideshows among other things and have included the libraries on my site.

    Regarding the tabs, Ronald Roe is probably right and I don't even need jquery. All I am doing is a basic tab structure with 5 tabs. The content will contain pictures, links, and text which will be populated from a table using php. I am not sure if I could just use html and css but I will give it a try. Thanks for your help, your help is a
    Im pretty new to web design but I am learning fast. I will help if I can.
    Check out my sites http://www.mediareviewzone.com http://www.iamrobsmith.com

  8. #7
    Member djitsz's Avatar
    Join Date
    Jan 2014
    Posts
    67
    Member #
    38199
    Liked
    17 times
    Just another thing to consider when deciding to link to jQuery via a Content Delivery Network (CDN) versus storing it on your own server is load times.

    Chances are that users will already have CDN versions in their browser cache so if you link your jQuery file from a CDN it means they will not have to download the file again. Improves the speed of your site.

    Pros and cons!

  9. #8
    Unpaid WDF Intern TheGAME1264's Avatar
    Join Date
    Dec 2002
    Location
    Not from USA
    Posts
    14,482
    Member #
    425
    Liked
    2783 times
    That can be more or less mitigated by caching static content and serving it using subdomains (e.g. serving all Javascript files using js.domain.com). By doing so, most modern browsers will download files in parallel, which decreases the overall load time of the site as a browser can download one part of the site while waiting for a response from the other.
    If I've helped you out in any way, please pay it forward. My wife and I are walking for Autism Speaks. Please donate, and thanks.

    If someone helped you out, be sure to "Like" their post and/or help them in kind. The "Like" link is on the bottom right of each post, beside the "Share" link.

    My stuff (well, some of it): My bowling alley site | Canadian Postal Code Info (beta)


Remove Ads

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
All times are GMT -6. The time now is 01:04 AM.
Powered by vBulletin® Version 4.2.3
Copyright © 2020 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: PurevB.com