You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Mostafa Mohamed <es...@gmail.com> on 2009/08/31 23:43:58 UTC

wicket + jquery

Hi i'm using the qtip jquery plugin to add tooltips, i use the following script:

$(document).ready(function()
{
    $('a[title]').qtip(
    {
        show: {
            when: 'click',
            solo: true
        },
        position: {
            corner: {
                target: 'topRight',
                tooltip: 'bottomLeft'
            }
        },
        style: {
            border: {
                width: 1,
                radius: 0,
                color: 'black'
            },
            padding: 10,
            textAlign: 'center',
            tip: true,
            title: {
                'border-width': '1px',
                'border-style': 'solid',
                'border-color': 'black'
            }
        }
    });
});

this will take <a title="tooltip text">tip</a> and display a tooltip
when the link is clicked.

However in one of my pages, when a user selects something from a drop
down choice i add a fragment to the page using ajax. when i click on
the tooltip link in this fragment the tooltip refuses to show. when i
click on a non-ajax loaded tooltip link, it works just fine. i'm
guessing it's because of $(document).ready. any clue as to how this
could be solved? can wicket be of help in something like this?

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: wicket + jquery

Posted by John Krasnay <jo...@krasnay.ca>.
Yeah, $(document).ready will not re-run upon AJAX changes. I think
jQuery 1.3 has something called "live selectors" that kick in whenever
the DOM changes. Alternatively, you could just attach some Javascript to
the AjaxResponseTarget that initializes qtip for the new elements you're
adding.

jk

On Mon, Aug 31, 2009 at 11:43:58PM +0200, Mostafa Mohamed wrote:
> Hi i'm using the qtip jquery plugin to add tooltips, i use the following script:
> 
> $(document).ready(function()
> {
>     $('a[title]').qtip(
>     {
>         show: {
>             when: 'click',
>             solo: true
>         },
>         position: {
>             corner: {
>                 target: 'topRight',
>                 tooltip: 'bottomLeft'
>             }
>         },
>         style: {
>             border: {
>                 width: 1,
>                 radius: 0,
>                 color: 'black'
>             },
>             padding: 10,
>             textAlign: 'center',
>             tip: true,
>             title: {
>                 'border-width': '1px',
>                 'border-style': 'solid',
>                 'border-color': 'black'
>             }
>         }
>     });
> });
> 
> this will take <a title="tooltip text">tip</a> and display a tooltip
> when the link is clicked.
> 
> However in one of my pages, when a user selects something from a drop
> down choice i add a fragment to the page using ajax. when i click on
> the tooltip link in this fragment the tooltip refuses to show. when i
> click on a non-ajax loaded tooltip link, it works just fine. i'm
> guessing it's because of $(document).ready. any clue as to how this
> could be solved? can wicket be of help in something like this?
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org