Set a class 'minimized' instead of hardcoding style

This commit is contained in:
JC Brand 2014-01-22 19:27:15 +02:00
parent b189e6dfcb
commit f2c354b7d9
2 changed files with 12 additions and 7 deletions

View File

@ -1268,6 +1268,10 @@ form.add-xmpp-contact input {
height: 324px; height: 324px;
} }
.box-flyout.minimized {
height: auto;
}
.chatbox .box-flyout { .chatbox .box-flyout {
width: 200px; width: 200px;
} }

View File

@ -26,9 +26,9 @@
handles: ['tm'], handles: ['tm'],
}); });
// Next, you must define two functions, isElement and isHandle. These are passed // Next, you must define isElement. These are passed a given DOM element, and must
// a given DOM element, and must "return true" if the element in question is a // "return true" if the element in question is a draggable element.
// draggable element or draggable handle. Here, I'm checking for the CSS classname // Here, I'm checking for the CSS classname
// of the elements, but you have have any combination of conditions you like: // of the elements, but you have have any combination of conditions you like:
dragresize.isElement = function(elm) { dragresize.isElement = function(elm) {
if (elm.className && elm.className.indexOf('box-flyout') > -1) return true; if (elm.className && elm.className.indexOf('box-flyout') > -1) return true;
@ -487,12 +487,13 @@ $(document).ready(function () {
} else { } else {
$grandparent.find('div.chat-content').slideToggle(300); $grandparent.find('div.chat-content').slideToggle(300);
} }
var flyout = $grandparent.find('.box-flyout')[0]; var flyout = $grandparent.find('.box-flyout');
if (flyout.style.height == 'auto') { if (flyout.hasClass('minimized')) {
flyout.style.height = '324px'; flyout.removeClass('minimized');
} else { } else {
flyout.style.height = 'auto'; flyout.addClass('minimized');
} }
$(ev.target).parent().parent().find('form.sendXMPPMessage').toggle(); $(ev.target).parent().parent().find('form.sendXMPPMessage').toggle();
}); });