views:

58

answers:

1

what i an trying to do is use jquery and a ul menu and on click it loads section divs from an external file and displays them in a content div and in thos section div i need this code to display it's results

<script type='text/javascript'>
imvu_avatar_name = "TheDarkRaver";
imvu_panel_name = "rankings_panel";
imvu_section_name = "mp_right";
imvu_panel_width = 320;
imvu_panel_height = 228;
</script>
<script type='text/javascript'
src='http://www.imvu.com/catalog/web_panel_js.php'&gt;
</script>

if u wanna see it in action just go to http://tdr.host22.com/sections.html

and to see where i want them to display

http://tdr.host22.com/

a link to the source of the html and script http://stackoverflow.com/questions/2101907/my-javascript-in-external-html-is-not-loading

+2  A: 

Looking at your site, you probably want to do this:

Put this somewhere on your page, maybe after all of your other content

<style>
#hiddenData{display:none;}
</style>
<div id="hiddenData">
    <div class="about">About text</div>
    <div class="home">Home text</div>
</div>

Then in your JS file put these functions (adapted from http://stackoverflow.com/questions/2101907/my-javascript-in-external-html-is-not-loading/2101965#2101965):

var GetData = function(id){
    return $("#hiddenData > div." + id);
};
$(document).ready( function() {
  var sections = $("#menu a");
  var loading = $("#loading");
  var content = $("#content");

  function showLoading() {
    loading.css( {
      visibility: 'visible',
      opacity: 1,
      display: 'block'
    } );
  }

  function hideLoading(){
    loading.fadeTo(1000, 0);
  }

  sections.click( function() {
    showLoading();
    content.slideUp();
    GetData(this.id);
    hideLoading();
    content.slideDown();
  } );
} );
s_hewitt
well hewitt i don't know what to do i've tried about everything i can think of and it will not load in the content
s32ialx