I'm having a problem using the jQuery slide animations on elements that are inside a container with a fixed height. I have a page in my application on which there is a large, scrollable div, inside which are contained many smaller divs, each of which represents a 'message' in a user's inbox. Within each message div is a 'delete' button, which when clicked, hides the message from the larger frame by using jQuery's slideUp()
function.
This was working fine until I added a max-height property to the container div. Now, when the delete button is clicked, there is no animation and instead the div immediately snaps out of sight. If I remove the max-height property from the frame, the animation works fine, but as the frame could contain any number of messages, I really need it to have a max height and to be scrollable when it exceeds that height.
I've tried replacing the built in slideUp()
function with my own animate function, and replacing max-height with a fixed height, but neither of those work.
These are some relevant CSS and JS samples:
//css
div.messageList
{
border: solid 1px #B22222;
cursor: default;
color: #000000;
max-height: 800px;
overflow: auto;
width: 100%;
}
.unreadMessage
{
margin: 2px;
border: solid 1px #B22222;
text-align: left;
background-color: #98FB98;
}
//js
function hideMessage(id) {
$('#' + id).slideUp(500);
}