ggalan
02-12-2012, 08:33 PM
i have a button which i would like to disable click until a certain action finishes
my code so far doesnt animate
i have tried different configurations but cant seem to get it to work
what am i doing wrong here?
<!DOCTYPE HTML>
<html lang="en-US">
<head>
<style type="text/css">
div{float:left; margin-right:50px;}
#rec{position:relative;}
</style>
<script src="http://code.jquery.com/jquery.min.js"></script>
<script type="text/javascript">
var num = 0;
var arr = [];
$(function(){
$('#btn2').click(function() {
$(this).unbind('click', function(){
$('#rec').animate({left:'+=50'}, 500, function(){
$('#btn2').bind('click');
});
});
num++;
$('#rec').html(num);
return false;
});
});
</script>
</head>
<body>
<div id="btn2"><a href="">right</a></div>
<div id="rec">0</div>
</body>
</html>
this animates but the bind doesnt work
$('#btn2 a').click(function() {
$(this).unbind('click');
$('#rec').animate({left:'+=50'}, 500, function(){
$('#btn2 a').bind('click');
});
});
my code so far doesnt animate
i have tried different configurations but cant seem to get it to work
what am i doing wrong here?
<!DOCTYPE HTML>
<html lang="en-US">
<head>
<style type="text/css">
div{float:left; margin-right:50px;}
#rec{position:relative;}
</style>
<script src="http://code.jquery.com/jquery.min.js"></script>
<script type="text/javascript">
var num = 0;
var arr = [];
$(function(){
$('#btn2').click(function() {
$(this).unbind('click', function(){
$('#rec').animate({left:'+=50'}, 500, function(){
$('#btn2').bind('click');
});
});
num++;
$('#rec').html(num);
return false;
});
});
</script>
</head>
<body>
<div id="btn2"><a href="">right</a></div>
<div id="rec">0</div>
</body>
</html>
this animates but the bind doesnt work
$('#btn2 a').click(function() {
$(this).unbind('click');
$('#rec').animate({left:'+=50'}, 500, function(){
$('#btn2 a').bind('click');
});
});