Hi
I'm opening a couple of forms in modal window, but I wanted to open it with the size I want (i.e. a very small modal window), but I didn't find how to do this, I've seen that in modal.js file there is this code in the display function (Drupal.CTools.Modal.show)
$('div.ctools-modal-content', context).css({
'width': $(window).width() * .8 + 'px',
'height': $(window).height() * .8 + 'px'
});
$('div.ctools-modal-content .modal-content', context).css({
'width': ($(window).width() * .8 - 25) + 'px',
'height': ($(window).height() * .8 - 35) + 'px'
});
Is there any way to override these sizes?
Thanks!
Comments
Comment #1
merlinofchaos commentedUnfortunately currently there is not. At some point I would like to some ability to set this, but for the moment the modal is very fixed. Try dialog.module which I believe will allow you to set that information?
Comment #2
naden commentedIt's possible without touching ctools modal.js but it's not the best solution. You have to decide on you own if it fit's in your case.
We just overwrite "Drupal.CTools.Modal.show" by making a copy of the function in our modules .js file like this:
Now you can toucht the code without hazzle.
Comment #3
merlinofchaos commentedThe most recent -dev of CTools now has a customizable modal. See #872072: Allow the modal to be more customizable
Comment #4
pcambraThat's great, thanks Earl
Comment #5
naden commentedThats a good step, but it should be also possible to have "no height" instead of pixel or percent, because if you submit a form via ajax and have to show validation or confirmation messages to the user, the modal dialog does not resize if you set a fixed height!
Comment #6
annazhong commentedWhile I don't think override it is a good way.
if you have reuse the ctools many time.
each time you want a special css,
how could you seperate them by this kind of override?
Comment #7
HAg commentedAll in all, it is bad practice to use JavaScript for position and resizing, since both can be done quicker and smoother using css, and because JavaScript usually use another bad practice, in-line style.
Comment #8
HAg commentedComment #9
HAg commentedComment #10
HAg commentedComment #11
joelpittetTriaging the 6.x issues, it's no longer supported.