Gmail Calendar Documents Reader Web more »
Recently Visited Groups | Help | Sign in
Google Groups Home
Conflict withjQuery Alert Dialogs
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  6 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
phil.jones88@googlemail.c om  
View profile  
 More options May 11, 5:41 am
From: "phil.jone...@googlemail.com" <phil.jone...@googlemail.com>
Date: Mon, 11 May 2009 02:41:41 -0700 (PDT)
Local: Mon, May 11 2009 5:41 am
Subject: Conflict withjQuery Alert Dialogs
Hello,

I am trying to implement:

http://abeautifulsite.net/notebook/87

I created a function:

        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.

Thanks,

Phil


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Kevin Dalman  
View profile  
 More options May 11, 3:31 pm
From: Kevin Dalman <kevin.dal...@gmail.com>
Date: Mon, 11 May 2009 12:31:33 -0700 (PDT)
Local: Mon, May 11 2009 3:31 pm
Subject: Re: Conflict withjQuery Alert Dialogs
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...

_maintainPosition: function(status) {
   if( $.alerts.repositionOnResize ) {
      switch(status) {
         case true:
            $(window).bind('resize', function() {
               $.alerts._reposition();
             });
             break;
         case false:
            $(window).unbind('resize');
            break;
      }
   }

}

Here is an UPDATED VERSION of that would avoid the problem.

_maintainPosition: function(status) {
   if( $.alerts.repositionOnResize ) {
      switch(status) {
         case true:
            $(window).bind('resize', $.alerts._reposition);
             break;
         case false:
            $(window).unbind('resize', $.alerts._reposition);
            break;
      }
   }

}

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"


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Kevin Dalman  
View profile  
 More options May 11, 3:38 pm
From: Kevin Dalman <kevin.dal...@gmail.com>
Date: Mon, 11 May 2009 12:38:05 -0700 (PDT)
Local: Mon, May 11 2009 3:38 pm
Subject: Re: Conflict withjQuery Alert Dialogs
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...

_maintainPosition: function(status) {
   if( $.alerts.repositionOnResize ) {
      if (status) $(window).bind( 'resize', $.alerts._reposition );
      else $(window).unbind( 'resize', $.alerts._reposition );
   }

}

/Kevin

On May 11, 12:31 pm, Kevin Dalman <kevin.dal...@gmail.com> wrote:


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Phil Jones  
View profile  
 More options May 12, 4:40 am
From: Phil Jones <phil.jone...@googlemail.com>
Date: Tue, 12 May 2009 01:40:10 -0700 (PDT)
Local: Tues, May 12 2009 4:40 am
Subject: Re: Conflict withjQuery Alert Dialogs
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:


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Kevin Dalman  
View profile  
 More options May 12, 12:14 pm
From: Kevin Dalman <kevin.dal...@gmail.com>
Date: Tue, 12 May 2009 09:14:09 -0700 (PDT)
Local: Tues, May 12 2009 12:14 pm
Subject: Re: Conflict withjQuery Alert Dialogs
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:

    * http://www.gnu.org/copyleft/gpl.html

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:


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Cory LaViska  
View profile  
 More options May 14, 8:43 am
From: Cory LaViska <clavi...@gmail.com>
Date: Thu, 14 May 2009 05:43:57 -0700 (PDT)
Local: Thurs, May 14 2009 8:43 am
Subject: Re: Conflict withjQuery Alert Dialogs
Hey guys, Cory here from A Beautiful Site.

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 :)

Best,
Cory LaViska
http://abeautifulsite.net/

On May 12, 12:14 pm, Kevin Dalman <kevin.dal...@gmail.com> wrote:


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »

Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2009 Google