[TYPO3-english] Load Page Content with JQuery - Doesn't work in TYPO3 Only?

Scotty C superscotty19 at yahoo.com
Tue Mar 13 06:19:42 CET 2012

Hi everyone,

A while back I started a thread asking for help on how to make a TYPO3 site load page content without a refresh. I even offered to pay someone to help me. I ended up figuring it out myself - couldn't be easier. All you need is some JQuery in the TS Template SETUP:

# Translation: When anything inside the "menu" id is clicked, 
# ONLY the stuff inside the "content" id will be loaded into the "content_bg" div
# Requires: CSS template with div id=menu and div id=content
page.headerData.20 = TEXT
page.headerData.20.value = <script language="JavaScript" type="text/javascript" src="http://code.jquery.com/jquery-latest.js"></script>
page.headerData.30 = TEXT
page.headerData.30.value = <script language="JavaScript" type="text/javascript"> $(document).ready(function() { $('#menu a').click(function() { $('#content_bg').load($(this).attr('href')+' #content');  return false; }); });  </script>

(sidebar: I know I can use IncludeJS but I've been having problems with it in other applications so I reverted to old faithful headerData) 

... and it works great! Also, if I replace '#menu a' with 'bodytext a' (i.e. a regular <a> tag/link in the content), that will work. But the problem is, it *only* works with one or the other, not both. I know the code is good because we've flogged it to death here: http://stackoverflow.com/questions/9574400/jquery-multiple-elements-clickfunction so that leads me to conclude it's something inside TYPO3. 

Can anybody help me find the right touch to make both menu links and content links do the fancy load-content-without-page-reload?

Thanks as always,

More information about the TYPO3-english mailing list