picozone / simplemodal

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

Parameters Overwrite #21

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
Some times users need to overwrite a default parameter, for example, if the
user wants to change the position style of the container, can't be done
witout changing source.

I would suggest changing the following code at line 272:

                .css($.extend(this.opts.containerCss, {
                    display: 'none',
                    position: 'fixed', 
                    zIndex: this.opts.zIndex + 2
                }))

with this:
                .css($.extend({
                    display: 'none',
                    position: 'fixed', 
                    zIndex: this.opts.zIndex + 2
                }, this.opts.containerCss))

Hope this help to improve your great pluging.

Original issue reported on code.google.com by martinradosta@gmail.com on 14 Jun 2009 at 11:49

GoogleCodeExporter commented 8 years ago
This has come up a couple of times and I have mixed feelings. On one hand, I 
want
developers to have complete control - on the other, I worry about unintended 
overrides.

Perhaps another option to control the position for just the container would do 
the
trick? The position for the overlay and iframe don't need to change do they?

Original comment by emartin24 on 22 Jun 2009 at 3:47

GoogleCodeExporter commented 8 years ago
I think, that programmers are responsible for overrides, not your plugin. 
Another option to control the position is less transparent as override. If you 
don't want to let programmers override some options, make the $.extend with 
three objects:
.css($.extend(
  {position: 'fixed'},
  this.opts.containerCss,
  {
    display: 'none',
    zIndex: this.opts.zIndex + 2
  }
))

And don't forget to mention it in documentation.

Original comment by tomas.ma...@gmail.com on 12 May 2011 at 3:19

GoogleCodeExporter commented 8 years ago
Hi Tomas,

Thanks for the comment and code suggestion.

The options are handled that way because SimpleModal was not originally built 
to handle anything but fixed positioning. Passing in a different position can 
cause issues. Once I can re-work SimpleModal to correctly handle non-fixed 
positioning, I will update the options to allow for developers to override the 
position property.

Thanks,
Eric

Original comment by emartin24 on 12 May 2011 at 3:32

GoogleCodeExporter commented 8 years ago
I've added the "fixed" option would should allow for this.

Original comment by emartin24 on 7 Mar 2012 at 2:31