i have garage gate image. i want when click on button image should move up.
but problem is that when i click on button image don’t move but slide hide from bottom of the image. here is my code
<script type="text/javascript">
$(document).ready(function(){
$(".open").click(function(){
$(".gate").slideToggle(3000)
});
});
</script>
<body>
<div class="main">
<a class="open" >Home page</a>
<div class="gate"></div>
</main>
</body>
You shouldn’t use .slideToggle(), what it does is to hide/show the element by animating the height value.
I’ve prepared and example using .animate() to animate the gate opening up when you press the “homepage” word:
See this working Fiddle!
HTML
JQUERY
The position where the animation ends, depends of your final goal, and your applied CSS as well!