Welcome Guest!

If you do not have an account yet on The Web Squeeze forums, please Register! It’s FREE and there are many benefits:

  • Receive Fast Advice
  • Learn Programming Languages
  • Get Professional Website Reviews
  • Quick Troubleshooting Assistance

> How Would One Fuse This Simple Function In Jquery?

This is a discussion on How Would One Fuse This Simple Function In Jquery?, within the Javascript section. This forum and the thread "How Would One Fuse This Simple Function In Jquery?" are both part of the Frameworks category.

 
Reply to this topicStart new topic
> How Would One Fuse This Simple Function In Jquery?
cosmicbdog
post Jul 4 2008, 01:54 AM
Post #1


Rapid Squeezer
****

Posts: 146
Joined: 3-July 08


This is a simple jquery rollover which seems to work alright. I'm just wondering if its possible to merge them to keep it DRY

CODE
$j(document).ready(function()
  {
      $j(".navtab").mouseover(function()
      {
          $j(this).addClass("on");
      });
      
      
  });
  
  $j(document).ready(function()
  {
      $j(".navtab").mouseout(function()
      {
          $j(this).removeClass("on");
      });
      
      
  });


Any ideas?

This post has been edited by cosmicbdog: Jul 4 2008, 01:56 AM
Go to the top of the page
 
+Quote Post
Rakuli
post Jul 4 2008, 04:51 AM
Post #2


Squeeze Machine
Group Icon

Posts: 766
Joined: 13-February 08
From: Catching the squeezed drips downunder.


CODE
$j(document).ready(function()
  {
      $j(".navtab").hover(
                function()
               { // Mouseover function
                        $j(this).addClass("on");
               },
                function ()
                { // Mouseout function
                      $j(this).removeClass('on');
                }
      );
      
      
  });


That ought'a do it.


--------------------
Luke Dingle . com

Turn Over a Playful Leaf on Web Design -- read about the javascript cat
Go to the top of the page
 
+Quote Post
cosmicbdog
post Jul 4 2008, 06:08 AM
Post #3


Rapid Squeezer
****

Posts: 146
Joined: 3-July 08


QUOTE (Rakuli @ Jul 4 2008, 07:51 PM) *
CODE
$j(document).ready(function()
   {
       $j(".navtab").hover(
                 function()
                { // Mouseover function
                         $j(this).addClass("on");
                },
                 function ()
                 { // Mouseout function
                       $j(this).removeClass('on');
                 }
       );
      
      
   });


That ought'a do it.

--


bs... there's a hover function prebuilt??!?! oh man... why did i take so long to get into jquery?

thank you... /me heads towards the jquery documentation to find more jewels
Go to the top of the page
 
+Quote Post
If you found The Web Squeeze to be helpful, please donate so we can keep this site FREE, FRESH, and fortified with Web Design & Development info!
Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 

Collapse

> Similar Topics

    Topic Title Replies Topic Starter Views Last Action
No New Posts   1 Daniela 488 15th February 2008 - 06:58 AM
Last post by: craig
No new   14 edd 609 15th May 2008 - 01:59 AM
Last post by: Antti
No New Posts   13 shanedizzle 457 11th April 2008 - 03:31 PM
Last post by: joey
No New Posts   2 Jason 382 6th May 2008 - 07:33 AM
Last post by: Rakuli
No New Posts   8 unitedcraig 575 9th September 2008 - 10:03 PM
Last post by: Monie