Custom JavaScript for Guests
4 posters
Page 1 of 1
Custom JavaScript for Guests
Is there a way to have a piece of JavaScript only show for guests who aren't logged in? For example, I have a banner that I want to show only to guests, and be hidden for users who are logged on. The banner is a .swf flash file. My forum link is imtv.forumotion.com. Below is the code I used for the banner.
I published the code under index_body. Anybody have any suggestions?
- Code:
<center><embed src="https://dl.dropboxusercontent.com/s/bdlv3w1on44kz0l/bannernow.swf" width="728" height="200" /></center>
I published the code under index_body. Anybody have any suggestions?
Re: Custom JavaScript for Guests
collinsexton wrote:Is there a way to have a piece of JavaScript only show for guests who aren't logged in? For example, I have a banner that I want to show only to guests, and be hidden for users who are logged on. The banner is a .swf flash file. My forum link is imtv.forumotion.com. Below is the code I used for the banner.
I published the code under index_body. Anybody have any suggestions?
The only way i can think of would be to create a custum widget and have the permissions set for guest only. Since the dimensions are 728 wide, then you may want to have it top center or bottom center in your portal and set portal as your home page? Or you can create a guest forum and have the code in the forums desription, then also have all permissions set for guest only.I guess at the top or bottom would be best for that as well.
kirk- Forumaster
- Posts : 11037
Reputation : 653
Language : English,Vulcan,Klingon, Romulan,& Gorn
Re: Custom JavaScript for Guests
Add this to your JavaScript codes (ACP -> Modules -> HTML & JavaScript -> JavaScript pages management -> Create a new JavaScript and select "In all the pages", the title is regardless).
- Code:
jQuery(document).ready(function(){
if(!(jQuery('#i_icon_mini_logout')){
jQuery('#i_logo').replaceWith('<embed src="https://dl.dropboxusercontent.com/s/bdlv3w1on44kz0l/bannernow.swf" width="728" height="200" />').css({'text-align':'center','vertical-align':'center','align':'center'});
}
});
Re: Custom JavaScript for Guests
Ultron's Vision wrote:Add this to your JavaScript codes (ACP -> Modules -> HTML & JavaScript -> JavaScript pages management -> Create a new JavaScript and select "In all the pages", the title is regardless).
- Code:
jQuery(document).ready(function(){
if(!(jQuery('#i_icon_mini_logout')){
jQuery('#i_logo').replaceWith('<embed src="https://dl.dropboxusercontent.com/s/bdlv3w1on44kz0l/bannernow.swf" width="728" height="200" />').css({'text-align':'center','vertical-align':'center','align':'center'});
}
});
Tried this, and it had no effect. Do I need to remove the original code I had in "index_body"?
Re: Custom JavaScript for Guests
Hi,
Just simply add this into the code you have used before:
Will look something like this:
Just simply add this into the code you have used before:
- Code:
<!-- BEGIN switch_user_logged_out -->YOUR CODE<!-- END switch_user_logged_out -->
Will look something like this:
- Code:
<!-- BEGIN switch_user_logged_out --><center><embed src="https://dl.dropboxusercontent.com/s/bdlv3w1on44kz0l/bannernow.swf" width="728" height="200" /></center><!-- END switch_user_logged_out -->
Re: Custom JavaScript for Guests
Sir Chivas wrote:Hi,
Just simply add this into the code you have used before:
- Code:
<!-- BEGIN switch_user_logged_out -->YOUR CODE<!-- END switch_user_logged_out -->
Will look something like this:
- Code:
<!-- BEGIN switch_user_logged_out --><center><embed src="https://dl.dropboxusercontent.com/s/bdlv3w1on44kz0l/bannernow.swf" width="728" height="200" /></center><!-- END switch_user_logged_out -->
Thanks! It worked exactly how I wanted it to! I thought I was missing something. Thanks everyone for your support! Topic solved.
Similar topics
» Custom name not showing for guests.
» Usernames not visible to guests after applying a Javascript code
» Simple question: How to add custom JavaScript to forum
» Javascript to CSS
» Help With A JavaScript
» Usernames not visible to guests after applying a Javascript code
» Simple question: How to add custom JavaScript to forum
» Javascript to CSS
» Help With A JavaScript
Page 1 of 1
Permissions in this forum:
You cannot reply to topics in this forum