[jQuery] Re: using jqModal - problem with executing jqm with triggers loaded in via AJAX

2007-08-01 Thread bleen

I found a trick burined inside the jqmodal example page ...

in your AJAX loaded content do this:

$().ready(function(){  });

This seems to work just like $(document).ready  but inside AJAX loaded
content.



[jQuery] Re: using jqModal - problem with executing jqm with triggers loaded in via AJAX

2007-07-31 Thread skatta

thanks for the advice brice, i don't need some special code where the
trigger is being dynamically added to the DOM? seems i have no issue
triggering the alert, but the trigger jqm will not fire with out the
trigger if it's part of the DOM, and if it's dynamic then it doesn't
do anything at all.

to be honest, i'm just  going to make my own modal. i can't seem to
understand how binds work ... i've read different articles over and
over but i'm simply not connecting the dots.

On Jul 31, 9:10 pm, Brice Burgess <[EMAIL PROTECTED]> wrote:
> On Jul 31, 11:54 am, skatta <[EMAIL PROTECTED]> wrote:
>
>
>
> > $('body').click(function(event) {
>
> >   if ($(event.target).is('.triggerit')) {
> >alert("Hi!");
> >$('#overlay').jqm({ajax: '@href', overlay:80, trigger:
> > '.triggerit'});
> >return false;
>
> > }
> > });
> >From the looks of it (I'm still confused @ your greater goal), you're
>
> calling $.jqm() multiple times on an element. This is "a bad
> thing"(tm). Perhaps $.jqmShow() is a better bet?
>
> $.jqmShow() effectively triggers displaying of an element $.jqm() has
> been called on. Think of $.jqm() as an initializer.
>
> e.g.;
>
> [!-- JS --!]
> $('body').click(function(event) {
>
>   if ($(event.target).is('.triggerit')) {
>alert("Hi!");
>$('#overlay').jqmShow();
>return false;
>   }
>
> });
>
> $('#overlay').jqm({ajax: '@href', overlay:80, trigger: false});  //
> the global click function handles .triggerit clicks -- no reason to
> assign one, or else the dialog would try to open TWICE each time
> a .triggerit element is clicked.
>
> Hope this serves as beneficial reference,
>
> ~ Brice



[jQuery] Re: using jqModal - problem with executing jqm with triggers loaded in via AJAX

2007-07-31 Thread Brice Burgess

On Jul 31, 11:54 am, skatta <[EMAIL PROTECTED]> wrote:
>
> $('body').click(function(event) {
>
>   if ($(event.target).is('.triggerit')) {
>alert("Hi!");
>$('#overlay').jqm({ajax: '@href', overlay:80, trigger:
> '.triggerit'});
>return false;
>
> }
> });

>From the looks of it (I'm still confused @ your greater goal), you're
calling $.jqm() multiple times on an element. This is "a bad
thing"(tm). Perhaps $.jqmShow() is a better bet?

$.jqmShow() effectively triggers displaying of an element $.jqm() has
been called on. Think of $.jqm() as an initializer.

e.g.;

[!-- JS --!]
$('body').click(function(event) {

  if ($(event.target).is('.triggerit')) {
   alert("Hi!");
   $('#overlay').jqmShow();
   return false;
  }
});

$('#overlay').jqm({ajax: '@href', overlay:80, trigger: false});  //
the global click function handles .triggerit clicks -- no reason to
assign one, or else the dialog would try to open TWICE each time
a .triggerit element is clicked.

Hope this serves as beneficial reference,

~ Brice









[jQuery] Re: using jqModal - problem with executing jqm with triggers loaded in via AJAX

2007-07-31 Thread skatta

anyone?

On Jul 31, 12:11 pm, skatta <[EMAIL PROTECTED]> wrote:
> also ... is there a better way to handle executing code that's loaded
> via ajax? something better than ...  $('body').click(function(event)
> { }
>
> On Jul 31, 11:54 am, skatta <[EMAIL PROTECTED]> wrote:
>
> > hello,
>
> > just when i thought i had a grip on executing jquery functions from
> > content that was loaded viaajaxand added to the dom dynamically, i
> > have this issue withjqModal.
>
> > i'm trying to open a modal window from code that was loaded in via
> > Javascript. so i use the following, this works on most of my code ...
> > but this is weird, it will not fire but will trigger the alert. i
> > tried it without - trigger: '.triggerit' - and that doesn't work
> > either.
>
> > now, if the content that triggers thejqmodalis already part of the
> > dom and not anajaxcall, it will work but i need to click it twice!
> > i'm confused, any ideas?
>
> > here's the code ...
>
> > $('body').click(function(event) {
>
> >   if ($(event.target).is('.triggerit')) {
> >alert("Hi!");
> >$('#overlay').jqm({ajax: '@href', overlay:80, trigger:
> > '.triggerit'});
> >return false;
>
> > }
> > });



[jQuery] Re: using jqModal - problem with executing jqm with triggers loaded in via AJAX

2007-07-31 Thread skatta

also ... is there a better way to handle executing code that's loaded
via ajax? something better than ...  $('body').click(function(event)
{ }



On Jul 31, 11:54 am, skatta <[EMAIL PROTECTED]> wrote:
> hello,
>
> just when i thought i had a grip on executing jquery functions from
> content that was loaded viaajaxand added to the dom dynamically, i
> have this issue withjqModal.
>
> i'm trying to open a modal window from code that was loaded in via
> Javascript. so i use the following, this works on most of my code ...
> but this is weird, it will not fire but will trigger the alert. i
> tried it without - trigger: '.triggerit' - and that doesn't work
> either.
>
> now, if the content that triggers thejqmodalis already part of the
> dom and not anajaxcall, it will work but i need to click it twice!
> i'm confused, any ideas?
>
> here's the code ...
>
> $('body').click(function(event) {
>
>   if ($(event.target).is('.triggerit')) {
>alert("Hi!");
>$('#overlay').jqm({ajax: '@href', overlay:80, trigger:
> '.triggerit'});
>return false;
>
> }
> });