4 Replies - 1527 Views - Last Post: 13 December 2012 - 10:14 PM

#1 charlo  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 3
  • Joined: 13-December 12

How to detect a jquery effect has been applied

Posted 13 December 2012 - 01:23 AM

i have a jquery code that animates a div when a mouseenter.the problem is that i have multiple divs that am applying the same animation and i want the animation to be applied to a div if none of the other div is currently animated. if their is the animated should stop before i animate another div.
Here is my code
$(".circle").mouseenter(function(){
     var div=$(this);
   
	 div.animate({width:'500px'},"slow",dropdown);
	
	var child=div.children("#header");
	var child2=div.children(".close");
    child.show();
	child2.show();
		$(".circle").bind();
  
	
  });
  function dropdown(){
    var div=$(this);
	div.children(".form").slideDown();
    }
	
	
 $(".close").click(function(){
    var div=$(this);
	var chid=div.parent();
	var parent=chid.parent();
	parent.children(".form").slideUp("slow",animationStep2 )

   });
	  
  function animationStep2()
{   var div=$(this);
    var parent=div.parent();
   parent.animate({width:'70px'},"slow");
    parent.children("#header").fadeOut();
 }
   function animationStep3()
{   var div=$(this);
   var parent=div.parent();
   div.children("#header").fadeOut("fast");
}
  
});

This post has been edited by Dormilich: 13 December 2012 - 05:52 AM
Reason for edit:: please use [CODE] [/CODE] tags when posting code


Is This A Good Question/Topic? 0
  • +

Replies To: How to detect a jquery effect has been applied

#2 raghav.naganathan  Icon User is offline

  • Perfectly Squared ;)
  • member icon

Reputation: 408
  • View blog
  • Posts: 1,440
  • Joined: 14-September 12

Re: How to detect a jquery effect has been applied

Posted 13 December 2012 - 01:56 AM

Can you please show us the HTML part of the code as well?

regards,
Raghav
Was This Post Helpful? 0
  • +
  • -

#3 charlo  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 3
  • Joined: 13-December 12

Re: How to detect a jquery effect has been applied

Posted 13 December 2012 - 03:15 AM

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
	<meta http-equiv="content-type" content="text/html; charset=utf-8"/>
	<title>ELectrical Company</title>
	<link href="styles/default.css" rel="stylesheet" type="text/css" />
	<script type="text/javascript" src="js/jquery.js"></script>
	<script type="text/javascript" src="js/easing.js"></script>
	<script type="text/javascript" src="js/cycle.js"></script>
	<script type="text/javascript" src="https://maps.googleapis.com/maps/api/js?key=AIzaSyAkTbvSbFzQOylyqmKN6B975PqfaFEAXTs&sensor=true"></script>
	<script type="text/javascript" src="js/scripts.js"></script>
</head>
<body onload="load()">
	<div class="circle circle1">
	</div>
	</br>
	<div class="circle circle2"> Add Layer</div>
	<div class="circle circle3"> Land Parcels</div>
	<div class="circle circle4"> Search For</div>
	<div class="circle circle5"> Reports </div>
	
	<div id="mapholder">
		
		<div id="map">
			
		</div>
 	</div>
</body>
</html>


MOD EDIT: Added code tags. When posting code...USE CODE TAGS!!!

:code:

This post has been edited by JackOfAllTrades: 14 December 2012 - 04:55 AM

Was This Post Helpful? 0
  • +
  • -

#4 raghav.naganathan  Icon User is offline

  • Perfectly Squared ;)
  • member icon

Reputation: 408
  • View blog
  • Posts: 1,440
  • Joined: 14-September 12

Re: How to detect a jquery effect has been applied

Posted 13 December 2012 - 03:34 AM

Well, I tried out your code and I got this message.

Quote

Google has disabled use of the Maps API for this application. The provided key is not a valid Google API Key, or it is not authorized for the Google Maps Javascript API v3 on this site. If you are the owner of this application, you can learn about obtaining a valid key here: https://developers.g...l#Obtaining_Key


regards,
Raghav

This post has been edited by raghav.naganathan: 13 December 2012 - 03:35 AM

Was This Post Helpful? 0
  • +
  • -

#5 gregwhitworth  Icon User is offline

  • Tired.
  • member icon

Reputation: 219
  • View blog
  • Posts: 1,604
  • Joined: 20-January 09

Re: How to detect a jquery effect has been applied

Posted 13 December 2012 - 10:14 PM

Even though it seems that your system might be out of date, I'll give you what I normally use. I usually use addClass() when I'm doing any type of event. This is great because you can then add other events or styles down the road if you want.

$('li').mouseover( function() { 
		$(this).addClass('current-mouseover');
	});
	$('li').mouseout(function () { 
		$(this).removeClass('current-mouseover');
	});


Was This Post Helpful? 1
  • +
  • -

Page 1 of 1