Solved

create hover effect for div

Posted on 2011-09-09
3
480 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:knowlton
  • 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: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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
JavaScript waiting 14 68
gif overlay 3 42
Return data with AJAX, JQUERY and PHP 13 55
jquery to restrict certain words from input in form 11 12
Hi all! Recently there was EE question and the person wanted to have a multi-column textbox <div> selection, so as a first step to answer I provided a link but that was not complete with JavaScript selection, but had a good style sheet. So as a ques…
How to build a simple, quick and effective accordion menu using just 15 lines of jQuery and 2 css classes
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…

911 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now