SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Member
    Join Date
    Feb 2014
    Posts
    2
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    How to attach jquery library and plugins?

    Hello and thanks you for any input. I am starting to apply query to my webpage in development. First off when I go to download the library, I come to this: http://code.jquery.com/jquery-2.1.0.js Nothing to download just a whole bunch of code I do not know what to do with it. In the head on my html I got this

    HTML Code:
    <head>
    <meta charset="UTF-8">
    
    
    <title>Swift</title>
    
    
    <link rel="stylesheet" type="text/css" href="Index.css">
    
    <link rel="stylesheet" href="css/ui-lightness/jquery-ui-1.10.4.custom.css" />
    
    <script src="/Users/Am/Desktop/Swift.Files/js/jquery-1.10.2.js"></script>
    <script src="/Users/AmDesktop/Swift.Files/js/jquery-ui-1.10.4.custom.js"></script>
    <script src="/Users/Am/Desktop/Swift.Files/js/jquery-ui-1.10.4.custom.min.js"></script>
    
    <script type='text/javascript' language='javascript' src='/Users/AM/Desktop/Swift.Files/index.js'></script>
    <link rel="stylesheet" type="text/css" href="Index.css">
    
    
    </head>
    In my .js code folder I have this


    Code JavaScript:
    $(document).ready(function() {
       $('.home').mouseenter(function() {
           $(this).animate({
               height: '+=10px'
           });
       });
    Last edited by Mittineague; Mar 8, 2014 at 12:55.

  2. #2
    Programming Team silver trophybronze trophy
    Mittineague's Avatar
    Join Date
    Jul 2005
    Location
    West Springfield, Massachusetts
    Posts
    17,141
    Mentioned
    190 Post(s)
    Tagged
    2 Thread(s)
    Quote Originally Posted by cire116 View Post
    .....
    First off when I go to download the library, I come to this: http://code.jquery.com/jquery-2.1.0.js Nothing to download just a whole bunch of code I do not know what to do with it.
    .....
    When the page loads in your browser you have downloaded it. Just save it as jquery-2.1.0.js and put it where you need it to be.

  3. #3
    It's all Geek to me silver trophybronze trophy
    ralph.m's Avatar
    Join Date
    Mar 2009
    Location
    Melbourne, AU
    Posts
    24,167
    Mentioned
    453 Post(s)
    Tagged
    8 Thread(s)
    Yes, it is a bit confusing to see "Download" and then be taken to a page of code. But anyhow, as Allan says, you can just click File > Save As, or whatever you see at the top left of your screen. Or you can copy all tat code and paste it into a file of any name you choose, such as jquery.js.

    There are two ways to link to jQeury: by storing a file on your server, such as

    Code:
    <script src="http://mysite.com/js/jquery-1.10.2.js"></script>
    or you can link directly to an online version of jQuery, such as

    Code:
    <script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
    Either way, make sure to put the link to the jQuery script before/above links to any other jQuery code on your page. Otherwise you'll get errors.

    Lastly, be careful not to make all your links only relative to folders on your computer. Paths like /Users/Am/Desktop/Swift.Files/ are going to fail once you pt your code online. If you are using server-side code like PHP, then set up a dev environment on your machine to mirror the online setup, so that your code will work in both places. You can download something like MAMP or XAMPP for that purpose.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •