Jump to content


These Forums Are Now Read-Only


For TubePress support, please post a question here or open a support ticket and we will be glad to assist.


Photo

thumbnails not working when pulled via jquery load()


  • Please log in to reply
1 reply to this topic

#1 d c

d c

    Newbie

  • Members
  • Pip
  • 2 posts

Posted 01 October 2012 - 05:38 PM

hi!

i posted this in another thread but figured this is a unique problem.

i'm using tubepress as normal - pulling down vimeo galleries and displaying them on my site. it all works perfectly when placed on a standalone page.

however, i am using the main page to dynamically pull in child pages and display their content using the jquery load() function.

i've set up a simple site to display how this works:

http://dev.pulsetrain.net

this script in the header pulls in the content and loads it into the div:

<script type="text/javascript">
$(document).ready(function() {

	$("#link1content").load('/test-page/'+ " #content");

});
</script>

this is the html/php on the page:


<div id="linkwrapper" style="text-align:center;">

<ul>
<li class="red"><a id="link1" href="#">WORK</a></li>  
  <div id="infocontent" style="text-align:center;">
	<div id="link1content" class="contentbox"></div>
  </div>
</ul>
</div>

so, when the main index is loaded, jquery goes and fetches the #content div from the '/test-page/' URL and inserts it into the #link1content div. this part works fine. however, the thumbnail links don't work. i'm not quite sure what's causing this, as the tubepress hooks should be active on every page. i assume it's just not catching the rel classes?

you can see that tubepress is doing its job on the child page: http://dev.pulsetrain.net/test-page/

any ideas how to make it work when pulled into the main index's div?

thanks!

#2 eric

eric

    Lead Developer

  • TubePress Staff
  • 2787 posts

Posted 01 October 2012 - 11:50 PM

Hello,

Thanks for a detailed explanation of your situation. Hopefully we should be able to figure this out.

I should preface this by saying that in the future TubePress will have first-class support for loading TubePress in unique ways like this, as opposed to its current state now where it basically demands to be loaded "statically" with the rest of the page. But, with a little work we can likely finagle it to play nice.

The problem is that on the "content" page (http://dev.pulsetrain.net/test-page/), there is some inline JavaScript near the end that properly initializes TubePress. However, jQuery's .load(), when used with a selector expression as you have, will simply strip out and not execute any inline JavaScript from the page that is being loaded. See this jQuery bug for some more details.

So one solution would be to omit the " #content" selector. e.g.

$("#link1content").load('/test-page/');
But that might lead to undesirable effects, so you might then have to craft a "new" /test-page/ that looks right when injected into your main page.

There are also some other ideas out there on Google (like this one) that might work - YMMV.

Hopefully this points you in the right direction?