Are you putting your code in the document ready function?

http://docs.jquery.com/Tutorials:Introducing_%24%28document%29.ready%28%29

On Aug 11, 6:51 am, Steven <html...@gmail.com> wrote:
> I'm using this code for my website to load pages dynamically:
>
>         var hash = window.location.hash.substr(1);
>         var href = $('#nav li a').each(function(){
>                 var href = $(this).attr('href');
>                 if(hash==href.substr(0,href.length-4)){
>                         var toLoad = hash+'.php #content';
>                         $('#content').load(toLoad)
>                 }
>         });
>
>         $('#nav li a').click(function(){
>
>                 var toLoad = $(this).attr('href')+' #content';
>                 $('#content').hide('fast',loadContent);
>                 $('#load').remove();
>                 $('#wrapper').append('<span id="load">LOADING...</span>');
>                 $('#load').fadeIn('normal');
>                 window.location.hash = 
> $(this).attr('href').substr(0,$(this).attr
> ('href').length-4);
>                 function loadContent() {
>                         $('#content').load(toLoad,'',showNewContent())
>                 }
>                 function showNewContent() {
>                         $('#content').show('normal',hideLoader());
>                 }
>                 function hideLoader() {
>                         $('#load').fadeOut('normal');
>                 }
>                 return false;
>
>         });
>
> It works great. However, I'm using a script for tooltips as well -
> when I load a page that has links/abbr's that need tooltips, the
> JavaScript doesn't run on them. My solution to this was to add a
> <script> in the #content of each page that needed tooltips, except
> that doesn't work either.
>
> Can anyone explain this to me? This is a bit frustrating; I may go
> back to static pages.

Reply via email to