function showAlertDialog(message, title) {
$.alerts.overlayOpacity = .80;
$.alerts.alert(message, title);
}
and call it from a link:
<a href="#" onclick="showAlertDialog('This is a custom alert box',
'Alert Dialog');">Show Example Alert Dialog Box</a>
and it breaks my layout, it all works prior to a dialog box being
created but after the dialog box is closed if you change your browsers
size the layout doesn't resize with it.
Anyone got any ideas or any other plugin with similar styling and
functionality that works with this great layout tool, got to say I
love this plugin and the great documentation and examples.
When the 'alerts' widget opens a dialog, it binds an event to
window.resize. When the alert closes, it removes ALL events from
window.resize! This is why the layout no longer resizes after you open
and close an alert.
This is the function in jquery.alert.js that does this...
I HAVE NOT TESTED THIS CODE. It *should* work, but I've had trouble in
the past trying to 'unbind' a specific method. If it doesn't work for
you, then notify the author of Alerts of the issue, give him my code
as a starting point, and ask him to fix his widget. In fact, you also
should send the author the code above if it works, so that he can
update his widget for all users.
FYI, another option would be to NEVER unbind the _reposition()
callback. Instead the _reposition() method could simply check to see
if a dialog is currently open, and if not, then just abort...
_reposition: function() {
if (!$("#popup_container").length) return;
This means the callback would only 'bind' ONCE - and remain bound. To
avoid binding multiple times, a property could be added:
$.alerts.isInitialized=true property...
_maintainPosition: function(status) {
if ($.alerts.isInitialized) return; // already bound
else $.alerts.isInitialized = true; // set the flag
Either of these solutions should work. Take your pick ;)
> <a href="#" onclick="showAlertDialog('This is a custom alert box',
> 'Alert Dialog');">Show Example Alert Dialog Box</a>
> and it breaks my layout, it all works prior to a dialog box being
> created but after the dialog box is closed if you change your browsers
> size the layout doesn't resize with it.
> Anyone got any ideas or any other plugin with similar styling and
> functionality that works with this great layout tool, got to say I
> love this plugin and the great documentation and examples.
Here's an even simpler version of maintainPosition(). With only 2
options, there is no benefit to switch/case syntax - if/else is
smaller and simpler...
> When the 'alerts' widget opens a dialog, it binds an event to
> window.resize. When the alert closes, it removes ALL events from
> window.resize! This is why the layout no longer resizes after you open
> and close an alert.
> This is the function in jquery.alert.js that does this...
> I HAVE NOT TESTED THIS CODE. It *should* work, but I've had trouble in
> the past trying to 'unbind' a specific method. If it doesn't work for
> you, then notify the author of Alerts of the issue, give him my code
> as a starting point, and ask him to fix his widget. In fact, you also
> should send the author the code above if it works, so that he can
> update his widget for all users.
> FYI, another option would be to NEVER unbind the _reposition()
> callback. Instead the _reposition() method could simply check to see
> if a dialog is currently open, and if not, then just abort...
> _reposition: function() {
> if (!$("#popup_container").length) return;
> This means the callback would only 'bind' ONCE - and remain bound. To
> avoid binding multiple times, a property could be added:
> $.alerts.isInitialized=true property...
> _maintainPosition: function(status) {
> if ($.alerts.isInitialized) return; // already bound
> else $.alerts.isInitialized = true; // set the flag
> Either of these solutions should work. Take your pick ;)
> /Kevin
> On May 11, 2:41 am, "phil.jone...@googlemail.com"
> > <a href="#" onclick="showAlertDialog('This is a custom alert box',
> > 'Alert Dialog');">Show Example Alert Dialog Box</a>
> > and it breaks my layout, it all works prior to a dialog box being
> > created but after the dialog box is closed if you change your browsers
> > size the layout doesn't resize with it.
> > Anyone got any ideas or any other plugin with similar styling and
> > functionality that works with this great layout tool, got to say I
> > love this plugin and the great documentation and examples.
Your solution works perfectly! I knew it was something to do with the
resizing the alerts did but I'm a new JavaScript programmer and
learning :)
One quick question regarding licenses. I have Google'ed and read about
the MIT license, but what are the implications if I wanted to use your
plugin in a commercial product?
Phil
On May 11, 8:38 pm, Kevin Dalman <kevin.dal...@gmail.com> wrote:
> Here's an even simpler version of maintainPosition(). With only 2
> options, there is no benefit to switch/case syntax - if/else is
> smaller and simpler...
> On May 11, 12:31 pm, Kevin Dalman <kevin.dal...@gmail.com> wrote:
> > Hi Phil,
> > When the 'alerts' widget opens a dialog, it binds an event to
> > window.resize. When the alert closes, it removes ALL events from
> > window.resize! This is why the layout no longer resizes after you open
> > and close an alert.
> > This is the function in jquery.alert.js that does this...
> > I HAVE NOT TESTED THIS CODE. It *should* work, but I've had trouble in
> > the past trying to 'unbind' a specific method. If it doesn't work for
> > you, then notify the author of Alerts of the issue, give him my code
> > as a starting point, and ask him to fix his widget. In fact, you also
> > should send the author the code above if it works, so that he can
> > update his widget for all users.
> > FYI, another option would be to NEVER unbind the _reposition()
> > callback. Instead the _reposition() method could simply check to see
> > if a dialog is currently open, and if not, then just abort...
> > _reposition: function() {
> > if (!$("#popup_container").length) return;
> > This means the callback would only 'bind' ONCE - and remain bound. To
> > avoid binding multiple times, a property could be added:
> > $.alerts.isInitialized=true property...
> > _maintainPosition: function(status) {
> > if ($.alerts.isInitialized) return; // already bound
> > else $.alerts.isInitialized = true; // set the flag
> > Either of these solutions should work. Take your pick ;)
> > /Kevin
> > On May 11, 2:41 am, "phil.jone...@googlemail.com"
> > > <a href="#" onclick="showAlertDialog('This is a custom alert box',
> > > 'Alert Dialog');">Show Example Alert Dialog Box</a>
> > > and it breaks my layout, it all works prior to a dialog box being
> > > created but after the dialog box is closed if you change your browsers
> > > size the layout doesn't resize with it.
> > > Anyone got any ideas or any other plugin with similar styling and
> > > functionality that works with this great layout tool, got to say I
> > > love this plugin and the great documentation and examples.
Glad it worked for you, Phil. Please pass the patch on to the
jquery.alerts author so he can update his widget and avoid similar
problems for other users in the future.
> One quick question regarding licenses. I have Google'ed and read
> about the MIT license, but what are the implications if I wanted to
> use your plugin in a commercial product?
Let me start by saying I am not an expert on the GPL license, so you
SHOULD NOT RELY ON the information I provide below. You can read the
GPL license info here:
That said, my undertanding is that using a widget in a website does
NOT require the entire website be under the GPL license - only the
widget itself. So if you use a GPL-licensed widget, *modified or
unmodified*, that widget must remains free, and must be downloadable
in a readable form. Since JS files are inherently downloadable and
readable, that should be sufficient to meet this requirement.
In other words, you do not need to worry about using Layout in a
commercial 'website' as long as you do not use obsfucation to try to
make the widget's source code unreadable, and the license info for the
widget remains intact.
Hope that helps.
/Kevin
On May 12, 1:40 am, Phil Jones <phil.jone...@googlemail.com> wrote:
> Your solution works perfectly! I knew it was something to do with the
> resizing the alerts did but I'm a new JavaScript programmer and
> learning :)
> One quick question regarding licenses. I have Google'ed and read about
> the MIT license, but what are the implications if I wanted to use your
> plugin in a commercial product?
> Phil
> On May 11, 8:38 pm, Kevin Dalman <kevin.dal...@gmail.com> wrote:
> > Phil,
> > Here's an even simpler version of maintainPosition(). With only 2
> > options, there is no benefit to switch/case syntax - if/else is
> > smaller and simpler...
> > On May 11, 12:31 pm, Kevin Dalman <kevin.dal...@gmail.com> wrote:
> > > Hi Phil,
> > > When the 'alerts' widget opens a dialog, it binds an event to
> > > window.resize. When the alert closes, it removes ALL events from
> > > window.resize! This is why the layout no longer resizes after you open
> > > and close an alert.
> > > This is the function in jquery.alert.js that does this...
> > > I HAVE NOT TESTED THIS CODE. It *should* work, but I've had trouble in
> > > the past trying to 'unbind' a specific method. If it doesn't work for
> > > you, then notify the author of Alerts of the issue, give him my code
> > > as a starting point, and ask him to fix his widget. In fact, you also
> > > should send the author the code above if it works, so that he can
> > > update his widget for all users.
> > > FYI, another option would be to NEVER unbind the _reposition()
> > > callback. Instead the _reposition() method could simply check to see
> > > if a dialog is currently open, and if not, then just abort...
> > > This means the callback would only 'bind' ONCE - and remain bound. To
> > > avoid binding multiple times, a property could be added:
> > > $.alerts.isInitialized=true property...
> > > _maintainPosition: function(status) {
> > > if ($.alerts.isInitialized) return; // already bound
> > > else $.alerts.isInitialized = true; // set the flag
> > > Either of these solutions should work. Take your pick ;)
> > > /Kevin
> > > On May 11, 2:41 am, "phil.jone...@googlemail.com"
> > > > <a href="#" onclick="showAlertDialog('This is a custom alert box',
> > > > 'Alert Dialog');">Show Example Alert Dialog Box</a>
> > > > and it breaks my layout, it all works prior to a dialog box being
> > > > created but after the dialog box is closed if you change your browsers
> > > > size the layout doesn't resize with it.
> > > > Anyone got any ideas or any other plugin with similar styling and
> > > > functionality that works with this great layout tool, got to say I
> > > > love this plugin and the great documentation and examples.
Thanks for the code fix suggestion :) I'll be happy to push an update
to that plugin this evening after I have a chance to implement this
and test it out. I'm sure it will work just fine.
Kevin: Thanks, I learned something new about $.unbind() today :)
> Glad it worked for you, Phil. Please pass the patch on to the
> jquery.alerts author so he can update his widget and avoid similar
> problems for other users in the future.
> > One quick question regarding licenses. I have Google'ed and read
> > about the MIT license, but what are the implications if I wanted to
> > use your plugin in a commercial product?
> Let me start by saying I am not an expert on the GPL license, so you
> SHOULD NOT RELY ON the information I provide below. You can read the
> GPL license info here:
> That said, my undertanding is that using a widget in a website does
> NOT require the entire website be under the GPL license - only the
> widget itself. So if you use a GPL-licensed widget, *modified or
> unmodified*, that widget must remains free, and must be downloadable
> in a readable form. Since JS files are inherently downloadable and
> readable, that should be sufficient to meet this requirement.
> In other words, you do not need to worry about using Layout in a
> commercial 'website' as long as you do not use obsfucation to try to
> make the widget's source code unreadable, and the license info for the
> widget remains intact.
> Hope that helps.
> /Kevin
> On May 12, 1:40 am, Phil Jones <phil.jone...@googlemail.com> wrote:
> > Thanks Kevin,
> > Your solution works perfectly! I knew it was something to do with the
> > resizing the alerts did but I'm a new JavaScript programmer and
> > learning :)
> > One quick question regarding licenses. I have Google'ed and read about
> > the MIT license, but what are the implications if I wanted to use your
> > plugin in a commercial product?
> > Phil
> > On May 11, 8:38 pm, Kevin Dalman <kevin.dal...@gmail.com> wrote:
> > > Phil,
> > > Here's an even simpler version of maintainPosition(). With only 2
> > > options, there is no benefit to switch/case syntax - if/else is
> > > smaller and simpler...
> > > On May 11, 12:31 pm, Kevin Dalman <kevin.dal...@gmail.com> wrote:
> > > > Hi Phil,
> > > > When the 'alerts' widget opens a dialog, it binds an event to
> > > > window.resize. When the alert closes, it removes ALL events from
> > > > window.resize! This is why the layout no longer resizes after you open
> > > > and close an alert.
> > > > This is the function in jquery.alert.js that does this...
> > > > I HAVE NOT TESTED THIS CODE. It *should* work, but I've had trouble in
> > > > the past trying to 'unbind' a specific method. If it doesn't work for
> > > > you, then notify the author of Alerts of the issue, give him my code
> > > > as a starting point, and ask him to fix his widget. In fact, you also
> > > > should send the author the code above if it works, so that he can
> > > > update his widget for all users.
> > > > FYI, another option would be to NEVER unbind the _reposition()
> > > > callback. Instead the _reposition() method could simply check to see
> > > > if a dialog is currently open, and if not, then just abort...
> > > > This means the callback would only 'bind' ONCE - and remain bound. To
> > > > avoid binding multiple times, a property could be added:
> > > > $.alerts.isInitialized=true property...
> > > > _maintainPosition: function(status) {
> > > > if ($.alerts.isInitialized) return; // already bound
> > > > else $.alerts.isInitialized = true; // set the flag
> > > > Either of these solutions should work. Take your pick ;)
> > > > /Kevin
> > > > On May 11, 2:41 am, "phil.jone...@googlemail.com"
> > > > > <a href="#" onclick="showAlertDialog('This is a custom alert box',
> > > > > 'Alert Dialog');">Show Example Alert Dialog Box</a>
> > > > > and it breaks my layout, it all works prior to a dialog box being
> > > > > created but after the dialog box is closed if you change your browsers
> > > > > size the layout doesn't resize with it.
> > > > > Anyone got any ideas or any other plugin with similar styling and
> > > > > functionality that works with this great layout tool, got to say I
> > > > > love this plugin and the great documentation and examples.