We hope you enjoy your visit.

You're currently viewing our forum as a guest. This means you are limited to certain areas of the board and there are some features you can't use. If you join our community, you'll be able to access member-only sections, and use many member-only features such as customizing your profile, sending personal messages, and voting in polls. Registration is simple, fast, and completely free.


Join our community!


If you're already a member please log in to your account to access all of our features:

Username:   Password:
Locked Topic
[ C ] Prevent HTML from Board Template Loading on Every Page
Topic Started: Aug 20 2012, 02:26 PM (382 Views)
JohnSlider
Member
[ *  * ]
Zetaboards

I have a large bit of HTML that I would like to only load on the forum homepage. For a while I have been using a code that hides the div my HTML is in from appearing on other pages in the forum, but it still slows the pages down big time because it still loads in the background. Is there a code that I can use that somehow stops this, or is it simply a limitation in board software and there's no real way around it? It's kind of a pain because for some reason it loads before the quick reply which makes the quick reply pop up 10 or so seconds later than everything else on the page/
Edited by JohnSlider, Aug 20 2012, 02:26 PM.
Offline Profile Goto Top
 
Cory
Member Avatar
Member
[ *  *  *  *  *  *  *  *  * ]
Add a DIV around the HTML with an ID:
Code:
 
<div id="homepage">
Insert HTML Here
</div>
Admin CP Posted Image Themes Posted Image Board Template Posted Image Javascripts
Code:
 
<style type="text/css">
#homepage {
display: none;
}
</style>
Admin CP Posted Image Themes Posted Image Board Template Posted Image Below the Board
Code:
 
<script type="text/javascript">
if (location.href.indexOf('/index') !== -1) $('#homepage').show();
</script>
Offline Profile Goto Top
 
JohnSlider
Member
[ *  * ]
Thanks, Cory. Is there a similar code for preventing the HTML from loading on a specific skin?
Offline Profile Goto Top
 
Cory
Member Avatar
Member
[ *  *  *  *  *  *  *  *  * ]
Add a DIV around the HTML with an ID if it doesn't already have one.

Admin CP Posted Image Themes Posted Image Board Template Posted Image Below the Board
Code:
 
<script type="text/javascript">
function fromTheme(themeID, htmlID) {
if ($('#setskin option[selected][value="' + themeID + '"]').length) $('#' + htmlID).hide();
}

fromTheme('THEME_ID', 'HTML_ID');
</script>
Edit the capitalized text as necessary and you can repeat that line to hide the HTML from more themes.

The theme ID can be retrieved via the Admin CP, when editing the theme the '&id=' number will be the themes ID. Don't include the number sign when inserting an HTML ID.
Offline Profile Goto Top
 
Steve
Member Avatar
patriot
[ *  *  *  *  *  *  *  *  *  * ]
Completed!

Your request has been completed. If you have any questions or concerns regarding the state of your request, please feel free to contact me via PM.
Offline Profile Goto Top
 
1 user reading this topic (1 Guest and 0 Anonymous)
« Previous Topic · Closed Requests · Next Topic »
Locked Topic