1

I have this example with a div which show / hide from the top, but I need it from the bottom to the top, I was trying to change some code, but I couldn't, and I didn't find any example.

<script type="text/javascript">
$(document).ready(function(){
    $(".btn-slide").click(function(){
        $("#panel").slideToggle("slow");
        $(this).toggleClass("active"); return false;
    });
});
</script>

Slide Panel

<div id="panel">
    <!-- you can put content here -->
</div>
5
  • 4
    jquery,html.html5,java This isn't a good question title. Commented Apr 3, 2013 at 9:37
  • Don't quite understand, the dive slides open from the top to bottom and slides closed from bottom to top. What do you want to do? jsfiddle.net/FLE3z Commented Apr 3, 2013 at 9:43
  • use animate() if you want to change the direction of your DIV Commented Apr 3, 2013 at 9:46
  • I didn't understand your issue .. jsfiddle.net/E9f6K/1 Commented Apr 3, 2013 at 9:48
  • hi plz check this link followtherainbow.com.au view the bottom right of map. you see the plus button .I hope you understand Commented Apr 3, 2013 at 9:51

3 Answers 3

1

You can also use the animate effect(http://api.jquery.com/animate/) and change the height of the div.

$(document).ready(function(){
$(".btn-slide").click(function(){
if($('#panel1').height=='0')
$("#panel1").animate({height:"140px"},{duration:1000});
else
$("#panel1").animate({height:"0px"},{duration:1000});

    });
});

this will act as a toggle as well as amimate from bottom

Sign up to request clarification or add additional context in comments.

Comments

0

You probably want to use slide effect provided by the jQuery UI. It allows you to define the direction as well.

Comments

0

You might want to use animate option in jquery, here is the code

HTML

<button class="btn-slide">Some Text</button>
<div id="box">
<div id="panel">Sample Text here<br/> Sample Text here<br/>Sample Text here</div>
</div>

CSS

#box
{
height: 100px;
width:200px;
position:relative;
border: 1px solid #000;
}
#panel
{
position:absolute;
bottom:0px;
width:200px;
height:20px;
border: 1px solid red;
display:none;
}

JQUERY

var panelH = $('#box').innerHeight();
$(".btn-slide").click(function(){
$("#panel").stop(1).show().height(0).animate({height: panelH},500);
});
});

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.