0

I've tried using the google api and my own jQuery.js file, and I'm checked it through a lot and my javascript code seems to be good, so I'm guessing it's something obvious between linking jQuery to the web page that I'm missing

Here's the code on JSFiddle

<!DOCTYPE html>
<html>
    <head>
        <title>COMPUTERS.</title>
        <link rel="stylesheet" type="text/css" href="cstyle.css">
        <script type="text/javascript" src="cscript.js"></script>
    </head>
    <body>
        <div id="navhead" align="center">
            <div id="navleft" class="nav">
                <p class="valign">Copyright and Patents</p>
            </div>
            <div id="navcentre" class="nav" align="center">
                <p class="valign">Computer Misuse</p>
            </div>
            <div id="navright" class="nav">
                <p class="valign">Data Protection</p>
            </div>
        </div>
    </body>
</html>

Javascript:

 $(document).ready(function(){
    $(".nav").mouseenter(function(){
        $(this).fadeTo("slow", 1);
    });
    $(".nav").mouseleave(function(){
        $(this).fadeTo("slow", 0.5);
    });
});
3
  • 1
    It seems to be working after including the jQuery file in the Frameworks & Extensions Commented Nov 1, 2013 at 10:20
  • You haven't included the call to jquery, whether that's on your local drive, or a CDN. Commented Nov 1, 2013 at 10:20
  • I added jQuery 1.9.1 in Frameworks & Extensions, and it seems to work, as is. Commented Nov 1, 2013 at 10:22

3 Answers 3

2

Where is the jquery.js

Include that in your file to work..

Add this line before your js

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>

Updated Fiddle http://jsfiddle.net/hzE4M/2/

Sign up to request clarification or add additional context in comments.

Comments

0

I tried your code in JSFiddle. It works.

$(".nav").mouseenter(function(){
    $(this).fadeTo("slow", 1);
});
$(".nav").mouseleave(function(){
    $(this).fadeTo("slow", 0.5);
});

http://jsfiddle.net/Alex_Zhe_Han/EmJZQ/

Comments

0
 <head>
        <title>COMPUTERS.</title>
        <link rel="stylesheet" type="text/css" href="cstyle.css">
<script src="http://code.jquery.com/jquery-1.9.1.js"></script>
        <script type="text/javascript" src="cscript.js"></script>
    </head>

your code is ok .just add this line.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.