Solved

create hover effect for div

Posted on 2011-09-09
3
477 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

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

DOM Attributes and Properties treatment with jQuery 1.6 by Ivo Stoykov jQuery (http://jquery.com/) 1.6 introduces .prop() (http://api.jquery.com/prop/) and .removeProp() (http://api.jquery.com/removeProp/) methods which allow modifying or removi…
This article discusses how to create an extensible mechanism for linked drop downs.
The viewer will learn how to dynamically set the form action using jQuery.
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)

762 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

18 Experts available now in Live!

Get 1:1 Help Now