Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

JavaScript Forum


You are currently viewing our JavaScript Forum as a guest. Please register to participate.
Login



Reply
probem with Start/Stop animation with mouse events.
Old 06-27-2011, 08:11 AM probem with Start/Stop animation with mouse events.
phazorRise's Avatar
Skilled Talker

Posts: 57
Name: Sachin Gutte
Trades: 0
How can i repeat certain animation when the mouse is moved onto particular element.
And stop it immediately when mouse is moved out from element.
Code:
  $("#previous").mouseenter(function(){
        $("#scroller").animate({scrollLeft: scrollAmount}, { duration: 'slow' , easing: 'easeOutBounce' }); //need to repeat this animation for certain times
  }).mouseleave(function(){
        $("#scroller").stop();
  });

  $("#-next").mouseenter(function(){
        $("#scroller").animate({scrollLeft: scrollAmount}, { duration: 'slow' , easing: 'easeOutBounce' });//need to repeat this animation for certain times
  }).mouseleave(function(){
        $("#scroller").stop();
  });
I also tried mouseover and mouseout events but yet code's not working.

I hope i'm clear. Thanks in advance.
phazorRise is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 06-27-2011, 12:25 PM Re: probem with Start/Stop animation with mouse events.
lizciz's Avatar
Super Spam Talker

Posts: 807
Name: Mattias Nordahl
Location: Sweden
Trades: 0
I *think* you'll want to animate when the mouse is over the element, not just when the mouse enters the elements. That is, you should use an mouseover event rather than mouseenter. (I'm not sure about the event names, but I'm guessing there is an event called mouseover, mousehover or similar)
__________________
Your answers will only be as good as your question. Formulate it well and give all the necessary information.
lizciz is online now
Reply With Quote
View Public Profile Visit lizciz's homepage!
 
Old 06-27-2011, 01:35 PM Re: probem with Start/Stop animation with mouse events.
phazorRise's Avatar
Skilled Talker

Posts: 57
Name: Sachin Gutte
Trades: 0
i tried using mouseover and mouseout events.
But it does not respond to mouseout event untill it finished with mouseover event.Though i'm taking mouse out of triggering element.
phazorRise is offline
Reply With Quote
View Public Profile
 
Old 06-27-2011, 07:51 PM Re: probem with Start/Stop animation with mouse events.
Super Spam Talker

Posts: 879
Name: Paul W
Trades: 0
http://unixpapa.com/js/mouse.html interesting article, though in someways out of date.
__________________

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE


*** New:
Please login or register to view this content. Registration is FREE
PaulW is online now
Reply With Quote
View Public Profile
 
Old 06-28-2011, 04:46 PM Re: probem with Start/Stop animation with mouse events.
Skilled Talker

Posts: 59
Name: Lisa Forgan
Location: Colorado
Trades: 0
You've probably seen this, but heck it can't hurt to have this link to review over.
Mouseovers
http://api.jquery.com/mouseover/

Please correct me if I'm wrong, but:
Mouseenter and mouseleave are almost the same as mouseover and mouseout except that they don’t react to event bubbling.
Puddlemut is offline
Reply With Quote
View Public Profile
 
Old 06-29-2011, 03:50 AM Re: probem with Start/Stop animation with mouse events.
Super Spam Talker

Posts: 879
Name: Paul W
Trades: 0
I thought (too lazy to check) that mouseenter and mouseleave were IE only?
__________________

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE


*** New:
Please login or register to view this content. Registration is FREE
PaulW is online now
Reply With Quote
View Public Profile
 
Old 06-29-2011, 03:00 PM Re: probem with Start/Stop animation with mouse events.
phazorRise's Avatar
Skilled Talker

Posts: 57
Name: Sachin Gutte
Trades: 0
demo on http://api.jquery.com/mouseover/ shows the difference. See the increments carefully.
Mouseenter event triggers only when mouse is entered onto parent element.
Mouseover event triggers both on parent and child element.

i guess that what it is. Correct me if i'm wrong !

Last edited by phazorRise; 06-29-2011 at 03:07 PM..
phazorRise is offline
Reply With Quote
View Public Profile
 
Old 07-05-2011, 03:30 AM Re: probem with Start/Stop animation with mouse events.
Experienced Talker

Posts: 35
Trades: 0
Quote:
Originally Posted by phazorRise View Post
How can i repeat certain animation when the mouse is moved onto particular element.
And stop it immediately when mouse is moved out from element.
Code:
  $("#previous").mouseenter(function(){
        $("#scroller").animate({scrollLeft: scrollAmount}, { duration: 'slow' , easing: 'easeOutBounce' }); //need to repeat this animation for certain times
  }).mouseleave(function(){
        $("#scroller").stop();
  });

  $("#-next").mouseenter(function(){
        $("#scroller").animate({scrollLeft: scrollAmount}, { duration: 'slow' , easing: 'easeOutBounce' });//need to repeat this animation for certain times
  }).mouseleave(function(){
        $("#scroller").stop();
  });
I also tried mouseover and mouseout events but yet code's not working.

I hope i'm clear. Thanks in advance.

Hello ,

You can do it on Hover event . instead of making in mouse enter you can use mouse hover event when mouse is moved over it it will get specified animation and when mouse is moved the animation will disappear .
__________________
Magento Themes Experts

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
shankar.adodis is offline
Reply With Quote
View Public Profile
 
Old 07-07-2011, 09:44 PM Re: probem with Start/Stop animation with mouse events.
mgraphic's Avatar
Truth Seeker

Latest Blog Post:
JAMISONTUNES
Posts: 2,918
Name: Keith Marshall
Location: Connecticut
Trades: 0
I think using hover() is the best bet:

Code:
  var _hoverAnimate = function(selector, action) {
 
      var animate = (action == 'animate') ? true : false;
 
      if (animate) {
 
           $(selector).animate({scrollLeft: scrollAmount}, { duration: 'slow' , easing: 'easeOutBounce' });
 
      } else {
 
          $(selector).stop();
      }
  };
 
 
  $("#previous").hover(_hoverAnimate("#scroller", 'animate'), _hoverAnimate("#scroller", 'stop'));
 
  $("#-next").hover(_hoverAnimate("#scroller", 'animate'), _hoverAnimate("#scroller", 'stop'));
__________________

<mgraphic /> - I don't have a solution but I admire the problem.

Last edited by mgraphic; 07-07-2011 at 09:45 PM..
mgraphic is offline
Reply With Quote
View Public Profile
 
Old 07-08-2011, 08:57 AM Re: probem with Start/Stop animation with mouse events.
Experienced Talker

Posts: 35
Trades: 0
Hello ,

Instead of using $ symbol please try using jQuery some cases $ symbol Will not be working.and if dont work then please recheck your function by putting it in console available with Firefox firebug
__________________
Magento Themes Experts

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
shankar.adodis is offline
Reply With Quote
View Public Profile
 
Old 07-09-2011, 04:19 AM Re: probem with Start/Stop animation with mouse events.
phazorRise's Avatar
Skilled Talker

Posts: 57
Name: Sachin Gutte
Trades: 0
Quote:
Originally Posted by shankar.adodis View Post
Hello ,

Instead of using $ symbol please try using jQuery some cases $ symbol Will not be working.and if dont work then please recheck your function by putting it in console available with Firefox firebug
i appreciate your help , thanks and i've solved the problem already.

And about $, it creates problem when we are using more than one library ie mootools,prototype,jquery etc together. and to avoid it jquery provides the method.

Code:
jQuery.noConflict()
the issue is discussed here - http://docs.jquery.com/Using_jQuery_...ther_Libraries
phazorRise is offline
Reply With Quote
View Public Profile
 
Old 07-09-2011, 04:21 AM Re: probem with Start/Stop animation with mouse events.
phazorRise's Avatar
Skilled Talker

Posts: 57
Name: Sachin Gutte
Trades: 0
Quote:
Originally Posted by mgraphic View Post
I think using hover() is the best bet:

Code:
  var _hoverAnimate = function(selector, action) {
 
      var animate = (action == 'animate') ? true : false;
 
      if (animate) {
 
           $(selector).animate({scrollLeft: scrollAmount}, { duration: 'slow' , easing: 'easeOutBounce' });
 
      } else {
 
          $(selector).stop();
      }
  };
 
 
  $("#previous").hover(_hoverAnimate("#scroller", 'animate'), _hoverAnimate("#scroller", 'stop'));
 
  $("#-next").hover(_hoverAnimate("#scroller", 'animate'), _hoverAnimate("#scroller", 'stop'));
yeah, i guess that'd be much better. thanks
phazorRise is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to probem with Start/Stop animation with mouse events.
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.40164 seconds with 12 queries