Bind Function to Ajax Generated DIV

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Bind Function to Ajax Generated DIV

Darren-61
Hey Guys;
I am having some issues attempting to bind a slideshow function to a
to div that lives within ajax loaded content.

Some quick info about what i am attempting.

- Portfolio Menu, click each title to load
- on click, load new portfolio peice(i.e website-name.html)
- Within website-name.html run a slideshow that requires a function
that is set in the main portfolio.html page.

I am using this slideshow - http://cssglobe.com/post/4004/easy-slider-15-the-easiest-jquery-plugin-for-sliding

This is the code i am using to attempt to init the slideshow

$('#portfolioHolder').bind('ajaxSuccess', function() {
        $("#slider").easySlider();
        alert("Content Load");
})

$("#slider").easySlider(); is the function i need to trigger. The
alert gets run but the easySlider() does nothing.

any ideas?

--
You received this message because you are subscribed to the Google Groups "jQuery Development" group.
To post to this group, send email to [hidden email].
To unsubscribe from this group, send email to [hidden email].
For more options, visit this group at http://groups.google.com/group/jquery-dev?hl=en.


Reply | Threaded
Open this post in threaded view
|

Re: Bind Function to Ajax Generated DIV

Rick Waldron
Hm.. Try live() instead? I havent bothered to test this, its more like vague advice. 

Next time, post this stuff to jquery-en


Rick

On Mon, Jan 18, 2010 at 8:34 PM, Darren <[hidden email]> wrote:
Hey Guys;
I am having some issues attempting to bind a slideshow function to a
to div that lives within ajax loaded content.

Some quick info about what i am attempting.

- Portfolio Menu, click each title to load
- on click, load new portfolio peice(i.e website-name.html)
- Within website-name.html run a slideshow that requires a function
that is set in the main portfolio.html page.

I am using this slideshow - http://cssglobe.com/post/4004/easy-slider-15-the-easiest-jquery-plugin-for-sliding

This is the code i am using to attempt to init the slideshow

$('#portfolioHolder').bind('ajaxSuccess', function() {
       $("#slider").easySlider();
       alert("Content Load");
})

$("#slider").easySlider(); is the function i need to trigger. The
alert gets run but the easySlider() does nothing.

any ideas?

--
You received this message because you are subscribed to the Google Groups "jQuery Development" group.
To post to this group, send email to [hidden email].
To unsubscribe from this group, send email to [hidden email].
For more options, visit this group at http://groups.google.com/group/jquery-dev?hl=en.





--
You received this message because you are subscribed to the Google Groups "jQuery Development" group.
To post to this group, send email to [hidden email].
To unsubscribe from this group, send email to [hidden email].
For more options, visit this group at http://groups.google.com/group/jquery-dev?hl=en.
Reply | Threaded
Open this post in threaded view
|

Re: Bind Function to Ajax Generated DIV

Mark-220
In reply to this post by Darren-61
This is definitely a bind vs live issue.  I'm doing something similar.

Any generated HTML with buttons/links that you want to bind to,
requires the use of live().  It's the same usage as bind(), just
replace bind with live().

On a similar note, what you are asking is fundamentally Event
Delegation/Event Bubbling.  You should check out this cool tutorial at
http://www.learningjquery.com/2008/03/working-with-events-part-1

-Cheers

On Jan 19, 9:34 am, Darren <[hidden email]> wrote:

> Hey Guys;
> I am having some issues attempting to bind a slideshow function to a
> to div that lives within ajax loaded content.
>
> Some quick info about what i am attempting.
>
> - Portfolio Menu, click each title to load
> - on click, load new portfolio peice(i.e website-name.html)
> - Within website-name.html run a slideshow that requires a function
> that is set in the main portfolio.html page.
>
> I am using this slideshow -http://cssglobe.com/post/4004/easy-slider-15-the-easiest-jquery-plugi...
>
> This is the code i am using to attempt to init the slideshow
>
> $('#portfolioHolder').bind('ajaxSuccess', function() {
>         $("#slider").easySlider();
>         alert("Content Load");
>
> })
>
> $("#slider").easySlider(); is the function i need to trigger. The
> alert gets run but the easySlider() does nothing.
>
> any ideas?

--
You received this message because you are subscribed to the Google Groups "jQuery Development" group.
To post to this group, send email to [hidden email].
To unsubscribe from this group, send email to [hidden email].
For more options, visit this group at http://groups.google.com/group/jquery-dev?hl=en.