jquery how do i execute this code and make it display in a div
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开发者_StackOverflow 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'>
</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 my javascript in external html is not loading
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 my javascript in external html is not loading):
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();
} );
} );
精彩评论