Reputation: 23
I Did something here and I just like to make the input slide from right to left.
I used simple code to show and hide the input field ,
$("#edit-search-block-form--2").animate({width:'toggle'},500);
Any help. Thanks
Upvotes: 2
Views: 11253
Reputation: 74738
As i understood your question is to slide the text input from right to left.
jQuery doesn't provide to slide an element from left or from right, so you can achive this with animate method which jQuery provides.
This is the way i implemented this:
$("#showhide").toggle(function() {
$("#search2").animate({'margin': '-=100px'}, 500);
$(this).toggleClass("closed");
}, function() {
$("#search2").animate({'margin': '+=100px'}, 500);
$(this).toggleClass("closed");
});
you can check a fiddle here:
Upvotes: 1
Reputation: 3642
I placed your input field in a div and set the float of both the link and the wrapper div to left:
<div id="input_wrapper">
<input type="text" id="search2" name="search_block_form" value="" size="30" maxlength="128" >
</div>
That forces the div to go from left to right.
Here is the updated Fiddle: http://jsfiddle.net/robertp/5Gq7L/10/
Upvotes: 2