Minimizing a popup window created with CSS with JQuery

I have a window that was created with CSS.  On this window I have placed the standard --- and X symbols for closing and minimizing the window.  These symbols have been placed inside a span using Html.  

When I click on the X or close button, I just remove the active class for the window and it disappears.  However, when I click on the -- (or minimize) button I am trying to use slideToggle(), but the window totally disappears.  Is there another function or some way to leave the top of the window open so the user can bring the window back.  


This is the markup for the buttons

<div class="ChatBottom1Title"><span>Chit-Chat</span><div class="ChatBottom1TitleNav"><span id="min">-</span><span id="close">X</span></div></div>

This is the jquery

$(document).ready(function(){
$('#close').click(function(){
    $(".ChatBottom1Wrap .ChatBottom1Popup").removeClass("active");
});
$('#min').click(function(){
    $(".ChatBottom1Wrap .ChatBottom1Popup").slideToggle();
});  
  });

Thanks in advance
sherbug1015Asked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Alexandre SimõesManager / Technology SpecialistCommented:
You have to split the window in 2 parts: the header and the content.
So basically you need a main div that represents the whole popup, and inside you need one div dor the header and another div for the content.

If you close, you can simply do what you're doing now and make the main div disappear.
To minimize, you can use the jQuery slideToggle() function but only on the content div.
Alexandre SimõesManager / Technology SpecialistCommented:
Here's a nice working example I did for you :)
http://jsfiddle.net/AlexCode/oxomgngc/

HTML
<div class="mypopup active">
    <h1>
        <span>My popup</span>
        <ul>
            <li><input type="button" value="_" role="minimize" /></li>
            <li><input type="button" value="X" role="close" /></li>
        </ul>
    </h1>
    <div>
        Here's some content for the popup
    </div>
</div>

Open in new window

Javascript
$(document).ready(function(){
    $(document).on('click', '.mypopup input[role=close]', function(){
        $(this).closest('.mypopup').removeClass("active");
    });
    $(document).on('click', '.mypopup input[role=minimize]', function(){
        $(this).closest('.mypopup').find('div').slideToggle();
    });  
});

Open in new window

CSS
.mypopup{
    width: 400px;
    border: solid 1px #dcdcdc;
    display: none;
}
.mypopup.active{
    display: block;
}
.mypopup > h1{
    background-color: #dcdcdc;
    font-size: 1em;
    padding: 5px;
    margin: 0;
}
.mypopup > h1 ul{
    margin: 0;
    padding: 0;
    display: block;
    float: right;
    list-style: none;
}
.mypopup > h1 ul li{
    float: left;
}
.mypopup > div {
    width: 100%;
    height: 300px;
    padding: 5px;
}

Open in new window

Alexandre SimõesManager / Technology SpecialistCommented:
If the idea is to make it behave like Facebook or Google chat, a small CSS change will do the trick:
http://jsfiddle.net/AlexCode/oxomgngc/1/

CSS
.mypopup{
    width: 400px;
    border: solid 1px #dcdcdc;
    position: absolute;
    bottom: 0;
    right: 5px;
    display: none;
}
.mypopup.active{
    display: block;
}
.mypopup > h1{
    background-color: #dcdcdc;
    font-size: 1em;
    padding: 5px;
    margin: 0;
}
.mypopup > h1 ul{
    margin: 0;
    padding: 0;
    display: block;
    float: right;
    list-style: none;
}
.mypopup > h1 ul li{
    float: left;
}
.mypopup > div {
    width: 100%;
    height: 300px;
    padding: 5px;
}

Open in new window

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
JavaScript

From novice to tech pro — start learning today.