jQuery - Plugins not working in loaded content

0
June 24, 2016

Short version:

I load content from a separate php page into a div in my other page. This is done using .Get I believe.

I've taken the plugin from net tuts +

http://nettuts.s3.cdn.plus.org/011jQuerySite/sample/index.htm

This is working, however, plugins that are supposed to work with the content that's just arrived aren't.

Only when specifying that page and loading that as a whole.

Long version:

I'm doing a website that's pretty graphics intensive. It's more like an application really, only with very "scarse" interface. So I liked the idea of loading only the new content directly onto the already loaded page instead of reloading everything.

And so I found a plugin from net tuts that did the very same thing.

http://nettuts.s3.cdn.plus.org/011jQuerySite/sample/index.htm

Basically, this plugin lets you load content from a said div container directly as a feed onto the page that's already loaded. So all pages are the same, with the only change being in the same div container as all pages have.

Now, several issues occurred. What I find strange(probably not for you) is the fact that plugins that I use somehow stop working when loading the content using the said plugin.

Cufon stopped working on the newly arrived content. And the same thing happens with a slide menu plugin as well that also arrives with the new content. But if I completely load the page that contains the div with Cufon and the slide menu, everything works as normal. But as soon as I click a link and new content arrives, plugins in that content does not work.

What am I missing? The pages are completely identical, with only a few differences in the a div container that both pages have. Clicking links are supposed to only remove existing content, fetch new content and place it in exactly the same location. One would think that scripts that are already loading in would work with the newly arrived content as well?

Comments See all(0)

Add comment
0
June 24, 2016

Am I allowed to bump? :)

0
June 24, 2016

Hi,

This "Clicking links are supposed to only remove existing content, fetch new content and place it in exactly the same location. " is not exactly what happens with the scripts. They stay in the same state, and they are not re-initialized by the load of a new content. It's probably why it doesn't always work.

Regards,

Dominique VINCENT

http://www.toitl.com/http://twitter.com/toitl

0
June 24, 2016

I see.. So I need to reinitialize the scripts after the ajax call. Is this something I need to do in the .load function?

This is the code I'm using to replace the content:

$('.dynload').live('click', function(){

var toLoad = $(this).attr('href')+' #content';

$('#content').fadeOut('fast',loadContent);

$('#ajaxloader').fadeIn('normal');

function loadContent() {

$('#content').load(toLoad,'',showNewContent())

}

function showNewContent() {

$('#content').fadeIn('fast',hideLoader());

//Cufon.replace('h1, h2, h3, h4, .menuwrapper', { fontFamily: 'advent'});

}

function hideLoader() {

$('#ajaxloader').fadeOut('normal');

}

return false;

});

And I've got this code snippet for the slidemenu:

$().ready(function() {

$('#kontrollpanel .slidepanels').kwicks({

min : 42,

spacing : 3,

isVertical : true,

sticky : true,

event : 'click'

});

});

What needs to be done? Can I also get Cufon to start working again as well perhaps? Cause that needs to be reinitialized as well I guess, cause it's not working in the newly loaded content. I tried putting Cufon.Replace in the load content function, but it didn't get updated and the Cufon font wasn't visible before I clicked another link, reinitilizing the loader again.

Related Questions

Is there a way to do away with $(document).ready(function()?

Hi everyone, so we have several jquery plugins running on our site and SOME require the $(document).ready(function() to start. This cause the page to hang in those areas that the content is linked t Read More

Views

18

Votes

0

Answers

2

June 24, 2016

Difference in replaceWith in jQuery 1.3 and 1.4?!?

Hi all, I can across some strage behaviour when using replaceWith in different jQuery versions. In one of our projects we use jQuery 1.3.2 more or less globally, on some pages we need version 1.4.3 f Read More

Views

14

Votes

0

Answers

0

June 21, 2016

Ajax and getting javascript/html

Hello! (first post here) I have over the course of half a year used jQuery from time to time and I love it. Now I even have the honor of doing a huge interface in javascript... of course adding jQuer Read More

Views

14

Votes

0

Answers

0

June 23, 2016

This is the very first question

Hello guys! This is the first post in this site Read More

Views

2k

Votes

4

Answers

2

January 08, 2016

report values not showing up.

I have a crystal report which I pass a DataSet to using VB.NET. The report was working fine, but then I make some changes to the import query and now nothing shows up in the crystal report. Crystal do Read More

Views

1k

Votes

0

Answers

12

September 06, 2005

Event log doesn't overwrite as needed in SP4

Hello All, After upgrading from SP3 to SP4 on several Windows 2000 PRO machines everything looked fine, but from time to time applications can't write to the event log. When I try to view the appl Read More

Views

1k

Votes

0

Answers

9

May 11, 2003

"Failed to self-register XYZ.dll"

Hi there, I wrote a OLE-automation-server DLL in VB4.0. I use Installshield Express to install it as part of my program on the target computers. Now on some computers I get the message "Failed to Read More

Views

5k

Votes

0

Answers

2

November 08, 1998

Please help understand these notes on image processing

Can someone please help me understand these lecture notes... On the right of the page; What does "normalised by one notion of the area of a pixel" mean? On the first formula for A, Is that a Read More

Views

1k

Votes

0

Answers

3

February 05, 2009

Can someone please explain this paragram on the chain rule in image processing

Please see the screenshot, How is 3133030 got from 10103322? Read More

Views

1k

Votes

0

Answers

1

January 05, 2009

AD on 2003

We have created an AD Domain on Windows 2000 Server with no problems. We just created an AD Domain on Windows 2003 and we're getting some weird problems. Both of these domains are behind firewalls Read More

Views

1k

Votes

0

Answers

15

May 11, 2003

ADDT ASP Upload Error " Type mismatch: 'tNG_isFileInsideBaseFolder' "

I am trying to create a simple insert record and upload image function on an ASP page built using Adobe Dreamweaver Developer Toolkit. I have done this many times before with no problem, however, i ha Read More

Views

1k

Votes

0

Answers

0

November 02, 2008

MYSQL Select query with custom ORDER BY

Hi, is it possible to customize the order of the returned rows in mysql? Example: I have a Table with a column "name", now I want to have all entries ordered by name, but I want the entries Read More

Views

1k

Votes

0

Answers

5

July 02, 2010

Folder Redirection in Server 2003

We have a Windows Server 2003 Standard Ed. Is there a way to redirect the users my documents to a folder that has already been created on the server? Read More

Views

1k

Votes

0

Answers

2

July 05, 2007

Partiton magic  version 8.0 having error 1523 while executing batch

I followed the partition magic 8.0 wizard to partition my hard disk while rebooting  I came across this problem  "error 1523 while executing batch" What can I do to solve this prob Read More

Views

1k

Votes

0

Answers

2

May 11, 2003

Please explain this paragraph in image processing (screenshot attached)

Two questions; How is the equation (10.1-15) formed? "are isotropic for rotation increments of 90 degrees and 45 degrees respectively" What does this mean Read More

Views

987

Votes

0

Answers

7

January 05, 2009

xp_cmdshell with net use

Hi, when I use 'net use \192.168.0.1\c$ password /user:username' at the command prompt, it works fine.  But if i try to use it in sql with " exec master..xp_cmdshell 'net use \19 Read More

Views

919

Votes

0

Answers

5

April 11, 2003

hp ux11

i have a hp ux11 server. and i edited the /etc/resolv.conf to use my win2003 server dns server. That went fine, however, I would like to go the other way and add an entry on my win2003 dns to resolve Read More

Views

564

Votes

0

Answers

3

October 12, 2009

Using an application over a LAN

I have written an application that needs to be used on a LAN.  The application setup wizard takes care of registering everything on a single PC, but how do you go about writing a setup program th Read More

Views

490

Votes

0

Answers

9

August 07, 1998

Need subnet of 12 IPs.

Please, Can someone help me to create a subnet consisting of 12 IP's. Thanks.. Read More

Views

489

Votes

0

Answers

5

April 11, 2003

Drill down in a cross-tabl report

Hello, Would some experts to show me if it is possible to do drill-up or drill-down (or both) in a cross-tab report? I would also like to know if it is possible to control what fields to be displayed/ Read More

Views

406

Votes

0

Answers

0

September 06, 2005