0

I have this code working perfectly fine on a page:

<script>
$(window).load(function() {
  ThumbnailScroller("tsv_container","vertical",40,800,"easeOutCirc",0.4,500);
});
</script>

<script type="text/javascript" src="jquery.thumbnailScroller.js"></script>

It doesn't however work, when i load this page into a div on another page.

I tried putting this code on the parent page with the div, but it still doesn't work. Can anyone tell me how to fix it so that the code runs on the parent page?

Book Of Zeus
  • 49,509
  • 18
  • 174
  • 171
WillingLearner
  • 7,106
  • 6
  • 34
  • 51
  • For one thing I would try reversing the two `script` tags shown in your code. ie put the link to thumbnailscroller before the reference to it. It's hard to see what's happening without a bit more code posted. – El Ronnoco Dec 27 '10 at 11:13
  • @El Ronnoco: I would to, but it doesn't matter; the `load` event doesn't happen until all scripts have been loaded. – T.J. Crowder Dec 27 '10 at 11:15
  • The problem is your loaded code is not evaluating. See: http://stackoverflow.com/questions/889967/jquery-load-call-doesnt-execute-javascript-in-loaded-html-file – amcc Oct 13 '11 at 10:58

2 Answers2

1

Because you use $(window).load(...), it's happen your browser load finish a page. But you load page into div by jQuery. It can't trigger load event. So you must call ThumbnailScroller function manually after loading page into div.

erinus
  • 734
  • 4
  • 5
  • – erinus Dec 27 '10 at 11:36
  • Could youy send your full sample to me? takira0922@gmail.com – erinus Dec 27 '10 at 11:54
  • Yes! I recived. But you didn't say your $(window).load(...) used in which file. And which file you wanna load to div? Give me info, thanks. – erinus Dec 27 '10 at 16:38
  • in the index file, you will see im loading 2 different pages into a div. If you were to test all the 3 html pages individually, you would see that 2 of those pages(_page3.html, _page4.html) work differently than when loaded into index.html. Im trying to get them to work the same way when they are loaded into #MainWrapper in the index.html file – WillingLearner Dec 27 '10 at 22:35
  • hey erinus, you never replied to my email – WillingLearner Dec 28 '10 at 23:33
  • Sorry! I test for a long time. I solve problem of _page4.html. It need you edit the index.htm(line 58). Change '
    hey
    ' to '
    hey
    '. Because MainWrapper has no enough horizontal space, your fourth block(gray) and fifth block(dark) will arrange down straightly. And the problem of _Page3.html is so strange, I'll keep solving it.
    – erinus Dec 29 '10 at 01:12
  • BTW, your question isn't your problem. When _page4.htm load into div will show differently, it is caused by ContentFlow.js, not ThumbnailScroller.js – erinus Dec 29 '10 at 01:17
0

put this line at the top

<script type="text/javascript" src="jquery.thumbnailScroller.js"></script>

something like

<script type="text/javascript" src="jquery.thumbnailScroller.js"></script>

<script>
$(window).load(function() {

 ThumbnailScroller("tsv_container","vertical",40,800,"easeOutCirc",0.4,500);
});
</script>
Shakti Singh
  • 84,385
  • 21
  • 134
  • 153