OK, first time, refactoring LoadProgramsAccordion.
function LoadProgramsAccordion() { $(function() { $("#programsaccordion, #programsaccordioninner, #policiesaccordioninner, #registrationaccordioninner").accordion({ autoHeight: false, navigation: true, collapsible: true }); }); $('.accordion .head').click(function() { $(this).next().toggle(); return false; }).next().hide(); }
Second, $(function(){ ... works the same as $(document).ready(){ function(){..., keep that in mind.
$(document).ready() only fires one time - right after the page loads. So if you are calling LoadProgramsAccordion multiple times, the inner stuff is only being executed one time.
Next, beware of $(this) , it can change unexpectedly. So this code
function ()
{
var src = $ (this) .attr ('src');
var popurl = src.replace ("thumbs /", "");
PopUpImage (popurl, $ (this));
});
should be changed to look like this:
function ()
{
var that = $ (this);
var src = that.attr ('src');
var popurl = src.replace ("thumbs /", "");
PopUpImage (popurl, that);
});
Next, I would need to see PopUpImage. You just have a lot going on to figure out where the issue is.
source share