I was trying to answer a question for someone else and I ran into weird/unexpected behavior from jquery. The width specified on rule 18 in the JSFiddle is unable to animate if I change it to 100% (in the example it is 200px by the way, so change it to 100% to see what I m talking about). I need this to be 100% so the button automatically fits the text.
The question is: "How do I make the animation work with 100% width???"
Jquery code:
$(document).ready(function(){
$(".ScrollDownArrow").click(function(){
if($(".ScrollDownArrow").hasClass("Clicked")){
$(".Hint img").fadeOut(500);
$(".Hint p").delay(500)/*wait on fadeout*/.animate({width: 200} /*Unfortunately width: 100% does not seem to work so I took a px value :(*/, 1000).animate({opacity:1}, 500);
$(".ScrollDownArrow").removeClass("Clicked");
}else{
$(".Hint p").animate({opacity:0.01}/*fade p out without making its width disappear for the width animation*/, 500).animate({width: 0}, 1000);
$(".Hint img").delay(1500).fadeIn(500);
$(".ScrollDownArrow").addClass("Clicked");
}
}); // End Click
});//End Ready