[jQuery] Problem with jquery plugin inside an ajax loaded php page
Hi
I am a noob with jquery, and I am learning by myself and building a site
with jquery php and mysql.
I have this problem:
Start page have a div for ajax loading and many links with image gallery
names that ajax load the same php page with diferent param Id for each
gallery. For example one link is viewfotos.php?IdGal=1, the other IdGal=2
and so on.
viewfotos.php get image names from a MySQL table and display with a jquery
plugin for gallery images.
The Problem is that when viewfotos.php load into the div by the ajax way it
only display the list of images and the jquery gallery plugin does not work.
But if I open viewfotos.php alone in browser it works OK.
I think the problem is that the $(document).ready event fires when I load
the start page, but not when I ajax load viewfotos.php page into a div.
This is the start page code for loading with ajax:
$(document).ready(function(){
var emi = "#nav a"; var rec = "#show";
var src = "images/loading.gif";
var iid = "loading";
var pre = '';
var spe = "slow"; $(emi).each(function(){
var href = $(this).attr("href"); $(this).click(function(){
$(rec).hide().after(pre).load(href, function()
{$("#"+iid).remove();$(this).fadeIn(spe);});
return false;
});
});
});
And here is the code inside viewfotos.php
$(document).ready(function(){
$('ul').jqGalViewII();
});
I think that the problem is that I can't put a ready event on a page ajax
loaded into a div, it only works at the main page, but I don't know how to
put all code in the ready event at main page.
Can anyone please give me some help for understanding how to make this
working.
Thanks
Gabriel Badano
--
View this message in context: http://www.nabble.com/Problem-with-jquery-plugin-inside-an-ajax-loaded-php-page-tp17606241s27240p17606241.html
Sent from the jQuery General Discussion mailing list archive at Nabble.com.