0 Replies - 6451 Views - Last Post: 17 February 2011 - 11:28 PM

#1 djbat  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 17-February 11

Jquery animate fails when code is piped in from separate file

Posted 17 February 2011 - 11:28 PM

Greetings all!

Well, I've hit a wall on this one. I'm trying to create a menu where I have a three part div making up the layout. 1 2 3.

1 is the "Meat" of all this and the plan is to pipe code into there which is not a problem. I'm doing this by a menu in div 3 which calls a simple javascript routine that uses innerHTML to pipe a pre-loaded batch of code into an div already defined in the main file.

Here's the odd part and obviously my knowledge is limited cause I can't figure this out.

If I run the code with the separate file placed into the marked div, it works fine. However, if I use this method of preloading and pushing it into place, the animate function of jquery fails yet everything still works visually and layout wise.

I've attached a rar file which has the index.html main file and the "included_file.html". It's pretty self-explanatory in how it works but the just is the "included_file.html" is loaded via:

<!--[if !IE]><!-->
<script type="text/javascript">
document.write('<object type="text/html" name="included_file" width="0" height="0" data="included_file.html"><\/object>');
</script>
<![endif]-->

<!--[if IE]>
<script type="text/javascript">
document.write('<iframe name="included_file" width="0" height="0" src="included_file.html"><\/iframe>');
</script>
<![endif]-->



From there I use this to push it into the predefined div:

<script type="text/javascript">
function changeContentProcess()
{
document.getElementById('Meat').innerHTML = window.frames['included_file'].document.getElementById('process').innerHTML}
</script>



The external file is encapsulated in a master div that's just a tag for reference so basically, everything within the div is spit out into the index.html's "Meat" div.

So for the life of me, the neeto scrolly animation which works if you put the external code in manually fails if placed in with Javascript.

Any ideas appreciated.

B.

Attached File(s)



Is This A Good Question/Topic? 0
  • +

Page 1 of 1