ordioxs / simplemodal

Automatically exported from code.google.com/p/simplemodal
0 stars 0 forks source link

Wrong container data size #75

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
SimpleModal or SimpleModal Contact Form (SMCF)?
SimpleModal

Version of SimpleModal of SMCF (indicate Demo or WordPress plugin)?
1.4.1

Version of jQuery?
1.6.2

Browser/OS you are experiencing the problem with?
Chrome 14.0.8… MacOS 10.7.1

As stated in an jQuery Ticket (http://bugs.jquery.com/ticket/7618), it does not 
really provide calculating the correct height of hidden elements. But the 
container dimensions are calculated and set before content is rendered. 
Therefore you might get badly sized modal windows. Calling 
setContainerDimensions() does not work, as the container height has already 
been set.

I fixed it locally by moving the setContainerDimensions() after showing the 
container and data, but I guess this is not the best way of handling it.2

Original issue reported on code.google.com by m...@jungeelite.de on 16 Sep 2011 at 12:43

GoogleCodeExporter commented 8 years ago
Well, I am not sure if you are using your github account, but I could provide 
you with a pull request for a working solution. Right now I added another 
method which almost copies the update() method, but instead of providing width 
and height, it re-evaluates the container data dimensions.

Original comment by m...@jungeelite.de on 17 Sep 2011 at 12:00

GoogleCodeExporter commented 8 years ago
I'm having similar problems with a modal with ajax.

First I create a link inside an HTML with a named class:

<a href="foo.htm" class="modal-link">bar</a>

Then, in the .js I add the event and load the external file I got from the href:

$('.modal-link').click(function(edata) {
    edata.preventDefault();
    $('<div></div>').load($(this).attr('href')).modal({
        overlayClose:true,
        minHeight:400,
        minWidth:750
    });
});

The problem is that the script detects the width and height of the data element 
('dw' and 'dh') as 0, thus setting s.d.wrap.css overflow to 'visible', instead 
to 'auto' (given that the external file is taller than the data container.

Is there a way to fix this?

As a workaround, I'm forcing the script to always use 'auto'.

Original comment by damianv...@gmail.com on 24 Oct 2011 at 1:14