Solved

create hover effect for div

Posted on 2011-09-09
3
491 Views
Last Modified: 2012-05-12
   $(document).ready(function ()
    {
        $('div[class*="catnav"]').css("border", "1px solid blue");        
    });

I want to take this collection and apply a hover effect for the divs...on hover do THIS...on "normal" do THIS....
0
Comment
Question by:Tom Knowlton
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 82

Accepted Solution

by:
leakim971 earned 500 total points
ID: 36513027
$(document).ready(function ()
    {
        $('div[class*="catnav"]').hover(
            function() { // on hover do THIS
               $(this).css("border", "1px solid blue");        
            },
            function() { // on "normal" do THIS
               $(this).css("border", "5px solid red");        
            }
        )          
            
    });

Open in new window


more info here : http://api.jquery.com/hover/
0
 
LVL 82

Expert Comment

by:leakim971
ID: 36513036
0
 
LVL 5

Author Closing Comment

by:Tom Knowlton
ID: 36513175
Thank you!

[my notes for later]

    $(document).ready(function ()
    {
        $('div[class*="catnav"]').hover(

            function ()
            {
                //$(this).stop().animate({ opacity: 1 }, 1000);
                $(this).css("background-color", "#eeeeee");
            },
            function ()
            {
                $(this).css("background-color", "#fafafa");
            }
            );
    });

Open in new window

0

Featured Post

Enroll in June's Course of the Month

June's Course of the Month is now available! Every 10 seconds, a consumer gets hit with ransomware. Refresh your knowledge of ransomware best practices by enrolling in this month's complimentary course for Premium Members, Team Accounts, and Qualified Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction HyperText Transfer Protocol (http://www.ietf.org/rfc/rfc2616.txt) or "HTTP" is the underpinning of internet communication.  As a teacher of web development I have heard many questions, mostly from my younger students who have come to t…
PROBLEM: The other day I was working on adding an ajax request to a webpage that already had a dialog box on the page.  The dialog box was using relative positioning to be positioned next to a form field I had on the page.  Everything was working…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

688 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question