views:

369

answers:

4

I'm using Eric Martin's sweet 'simplemodal' jQuery plugin. It works wonderfully and would recommend it to anyone looking for a lightweight jQuery-based modal dialogue solution.

That said, I have some particularly long content that "needs" to be displayed as a modal. By default, the container element uses 'overflow:auto' to handle content that is too long to fit within the browser window. This works well in most cases, but in this case I would like the dialogue to remain full height and scroll with the rest of the page (positioned 'absolute' vs. 'fixed'). I can get this working fairly easily by modifying any position: 'fixed' references in the source to position: 'absolute' but this sucks as it means ALL my modals will display this way...

Anyone have any thoughts on how to make this work gracefully?

+1  A: 

try adding position:absolute to the actual modal call for that particular div region

like below

$("#somebutton").click(function() {

    $('#my-modal-content').modal({
        position:absolute
    });
});

I had the same issue as you, but I wanted a different size box for different buttons/functions and this is how I solved it. Good Luck!

sdmiller
@myself: unless of course this is already supplied as sdmiller suggests above :-) in which case there is no need to rework the source.
prodigitalson
Adding "position:'absolute'" to the modal call, unfortunately, doesn't seem to do anything at all...
droo
This is the form I followed for overriding the default CSS// Change min height and width$("#sample").modal({ minHeight:400, minWidth: 600});this example/ Manually set position using percentages$("#sample").modal({position: ["50%","50%"]});I found these on his page.you could try position:[absolute]
sdmiller
Looks like he use to positioning types..........................// Manually set position$("#sample").modal({position: [10,10]});.............................................. and // Manually set position using percentages$("#sample").modal({position: ["50%","50%"]});.................................................I got both of those to work on my program... couldn't get absolute to work.... hmmm
sdmiller
A: 

Just have a scrollbar in the dialog itself.

Thom Smith
This (as mentioned) is actually the default behavior...
droo
A: 

It sounds like youre not adverse to adapting the source to you specific needs... therefore i would recommend reworking it so that you can supply the positioning and overflow properties via an options object.

prodigitalson
Yes, unfortunately this is the conclusion I've come to...modifying Eric's source to allow for specifying the positioning via an additional option. Thanks for your input/feedback!
droo
A: 

You'd have to change the code significantly, especially the code that deals with IE (IE6 mainly).

Just changing to an absolute position would work initially for certain browsers, but some browsers or a page resize (in any browser) would revert back to a fixed position.

Eric Martin