Go Back   vb.org Archive > vBulletin Modifications > vBulletin 3.8 Modifications > vBulletin 3.8 Template Modifications
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools
Changing logo image on mouse-over or mouse-click Details »»
Changing logo image on mouse-over or mouse-click
Version: 1.00, by BirdOPrey5 (Senior Member) BirdOPrey5 is offline
Developer Last Online: Aug 2023 Show Printable Version Email this Page

Category: Forum Display Enhancements - Version: 3.8.x Rating:
Released: 05-26-2010 Last Update: Never Installs: 8
Supported Template Edits
Re-useable Code  

This isn't much of a mod but is more confusing then I thought it would be so I figured why not release it for anyone interested.

This code will let you change your forum logo to an alternate image with Javascript when you bring the mouse over or click on it. Usually you'd make a version of the logo that looks like it's a button being pushed down, or otherwise selected- but any image will do. I don't have an example because it would simply be an image before the mouse-over and a different image during the mouse-over.

However here is a demo: http://www.juot.net/forums/
Mouse-over the logo image for a subtle change.

If a user doesn't have Javascript enabled only the original image will be displayed.

1. Go to Styles & Templates -> Style Manager -> All Style Options
In the bottom of headerinclude enter the following Javascript code:
Code:
<!-- Begin onmouseover Logo Script-->
<script language="Javascript">
if (document.images) {
    pic1 = new Image;
    pic2 = new Image; 
    pic1.src = 'path/picture1.gif';
    pic2.src = 'path/picture2.gif';
    }
</script>
<!-- End onmouseover Logo Script-->
Change path/picture1.gif / picture2.gif to the full path to your images, probably something like 'images/misc/logo1.gif' and 'images/misc/logo2.gif'

2. Now go to the header box under 'Common templates" make the following change...

find
Code:
<a href="$vboptions[forumhome].php$session[sessionurl_q]"><img src="$stylevar[titleimage]" border="0" alt="$vboptions[bbtitle]" /></a>
and replace it with the following:
Code:
<!-- Begin onmouseover Logo Code-->
<a href="$vboptions[forumhome].php$session[sessionurl_q]" onmouseover="document.rollover.src=pic2.src"  onmouseout="document.rollover.src=pic1.src" ><img src="$stylevar[titleimage]" border="0" alt="$vboptions[bbtitle]" name="rollover" /></a>
<!-- End onmouseover Logo Code-->
That should do it... note you want to keep the correct #1 image as your defined logo using the above code, otherwise you can ignore your defined logo and use the following alternate code:
Code:
<!-- Begin onmouseover Logo Code-->
<a href="$vboptions[forumhome].php$session[sessionurl_q]" onmouseover="document.rollover.src=pic2.src"  onmouseout="document.rollover.src=pic1.src" ><img src="images/misc/logo1.gif" border="0" alt="$vboptions[bbtitle]" name="rollover" /></a>
<!-- End onmouseover Logo Code-->
minding you will need to change "images/misc/logo1.gif" to the path to your main (un-clicked) logo image.

If you want to change the image on a mouse-click instead of mouse over change "onmouseover" to "onclick".

Please remember to click 'Marked As Installed" if you use this.

Show Your Support

  • This modification may not be copied, reproduced or published elsewhere without author's permission.
Благодарность от:
cjh1471

Comments
  #2  
Old 05-27-2010, 11:09 PM
BirdOPrey5's Avatar
BirdOPrey5 BirdOPrey5 is offline
Senior Member
 
Join Date: Jun 2008
Location: New York
Posts: 10,610
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Just wanted to thank whoever gave me a low rating, without being man enough to actually post what you find so poor about it... very classy. :/
Reply With Quote
  #3  
Old 05-28-2010, 12:17 PM
MagicThemeParks's Avatar
MagicThemeParks MagicThemeParks is offline
 
Join Date: Sep 2009
Posts: 850
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Any demos of this? Interested to see it in action
Reply With Quote
  #4  
Old 05-28-2010, 01:34 PM
BirdOPrey5's Avatar
BirdOPrey5 BirdOPrey5 is offline
Senior Member
 
Join Date: Jun 2008
Location: New York
Posts: 10,610
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

OK, Demo here: http://www.juot.net/forums/
It's very subtle in my case, but could be two completely different images if need be.

Edit- for your forum would be great if you could somehow animate that flag on a mouse-over... not sure your graphic skills but an animated gif would be perfect if you could do it.
Reply With Quote
  #5  
Old 06-13-2010, 10:34 PM
dadoc's Avatar
dadoc dadoc is offline
 
Join Date: Apr 2008
Location: Australia
Posts: 193
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I will surely use this mod with my new logo
Thanks Joe, nice mod
Reply With Quote
  #6  
Old 06-14-2010, 03:15 AM
pakhackerz pakhackerz is offline
 
Join Date: Jun 2010
Posts: 6
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

nice share keep it up
Reply With Quote
  #7  
Old 06-14-2010, 03:43 AM
BirdOPrey5's Avatar
BirdOPrey5 BirdOPrey5 is offline
Senior Member
 
Join Date: Jun 2008
Location: New York
Posts: 10,610
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

thanks guys.
Reply With Quote
  #8  
Old 09-27-2010, 04:34 AM
Hell Bomb Hell Bomb is offline
 
Join Date: Jun 2009
Posts: 385
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

You can actually achieve a lot better results using only css, which in turn makes it more universal. And with CSS you can make it only a single image which reduces http requests
Reply With Quote
  #9  
Old 09-27-2010, 01:15 PM
BirdOPrey5's Avatar
BirdOPrey5 BirdOPrey5 is offline
Senior Member
 
Join Date: Jun 2008
Location: New York
Posts: 10,610
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by hellbomb View Post
You can actually achieve a lot better results using only css, which in turn makes it more universal. And with CSS you can make it only a single image which reduces http requests
Thanks... feel free to release those instructions and link it here. :up:
Reply With Quote
  #10  
Old 09-16-2011, 08:32 AM
danyxxx danyxxx is offline
 
Join Date: Oct 2010
Posts: 52
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

This modification makes my style xhtml invalid because:

PHP Code:
Line 166Column 78there is no attribute "onMouseOver"

&#8230;06b1df33c8a26331c9d7bc3b" onMouseOver="document.rollover.src=pic2.src" onMouse… 
PHP Code:
Line 166Column 122there is no attribute "onMouseOut"

&#8230;="document.rollover.src=pic2.src" onMouseOut="document.rollover.src=pic1.src" > 
Any solution for this?
I mean.. must be a way to make that attribute valide , no?
Because I really want to keep my style xhtml valid

Kind Regards !

-------------------

EDIT & UPDATE:

You must edit your modification codes this way -->

1. onmouseover instead --> onMouseOver
2. onmouseout instead --> onMouseOut

--> After:

This document was successfully checked as XHTML 1.0 Transitional!


Enjoy and thanks for this BirdOPrey5 !
Reply With Quote
Благодарность от:
BirdOPrey5
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 01:07 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.04418 seconds
  • Memory Usage 2,326KB
  • Queries Executed 24 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (4)bbcode_code
  • (2)bbcode_php
  • (1)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)modsystem_post
  • (1)navbar
  • (4)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (10)post_thanks_box
  • (2)post_thanks_box_bit
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (2)post_thanks_postbit
  • (10)post_thanks_postbit_info
  • (9)postbit
  • (10)postbit_onlinestatus
  • (10)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • fetch_musername
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • post_thanks_function_fetch_thanks_bit_start
  • post_thanks_function_show_thanks_date_start
  • post_thanks_function_show_thanks_date_end
  • post_thanks_function_fetch_thanks_bit_end
  • post_thanks_function_fetch_post_thanks_template_start
  • post_thanks_function_fetch_post_thanks_template_end
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete