By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,504 Members | 1,190 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,504 IT Pros & Developers. It's quick & easy.

How to configure this script to start on click instead of on hover ? (jQuery)

ilya Kraft
100+
P: 134
Hello,

I'm struggling to find out how to configure following script to start on mouse click instead of hover.

I tried replacing .hover with .focus .click .mouseover but it did not work.

Expand|Select|Wrap|Line Numbers
  1. $(document).ready(function(){
  2.  
  3.     $(".reginput input").hover(function() {
  4.       $(this).next("em").animate({opacity: "show", top: "-75"}, "slow");
  5.     }, function() {
  6.       $(this).next("em").animate({opacity: "hide", top: "-85"}, "fast");
  7.     });
  8.  
  9. });
  10.  
May 13 '11 #1
Share this Question
Share on Google+
1 Reply


100+
P: 1,059
here is a little example with your problem
Expand|Select|Wrap|Line Numbers
  1. <div onclick='$(".reginput input").hover(function(){$(this).next("em").animate({opacity: "show", top: "-75"}, "slow");}, function() {$(this).next("em").animate({opacity: "hide", top: "-85"}, "fast");});'>
  2. </div>
  3.  
Have any doubt?
May 14 '11 #2

Post your reply

Sign in to post your reply or Sign up for a free account.