Wednesday, July 29, 2009

[jQuery] Re: jqm and livequery issue

uncomment the return false

jjshell wrote:
> Hi,
>
> Please consider the code below. It should open a modal everytime a
> link of a given class is clicked. But... it does not.
>
>
> //get the url of the link clicked
> var url;
> $('a.edit').livequery('click',function(){
> url= $(this).attr('href');
> });
>
> //initiate the modal box
> $('#modal-test').jqm({
> ajax: '@href',
> trigger: false;
> onHide: function(h) {
> url = url + 'removeSession/edit/';//remove session
> $.get(url);
> h.o.remove(); // remove overlay
> h.w.fadeOut(0.88); // hide window
> },
> });
>
> //now display the modal
> $('a.edit').livequery('click',function(){
> $('#modal-test').jqmShow();
> //return false;
> });
>
>
>
> When a link of class .edit is clicked, the overlay covers the page for
> an instant, then a redirect occurs to the page that should be loaded
> in the modal box (instead of the page being loaded in the modal).
>
> It's probably a small mistake as I can get it working the way I want
> using jqm 'trigger:a.edit'. The problem with this approach is that I
> lose the livequery power (links from ajax loaded content won't fire
> jqm).
>
> Thanks in advance for your help.
>
> Regards,
>
> -jj. :)
>

No comments: