Go Back   vb.org Archive > vBulletin Modifications > Archive > vB.org Archives > vBulletin 3.5 > vBulletin 3.5 Template Modifications
Opacity change on mouseover buttons Details »»
Opacity change on mouseover buttons
Version: 1.00, by TygerTyger TygerTyger is offline
Developer Last Online: Jul 2012 Show Printable Version Email this Page

Version: 3.5.0 Rating:
Released: 10-08-2005 Last Update: Never Installs: 9
 
No support by the author.

Name: Opacity change on mouseover buttons
Description: This will add a 'fade in/fade out' effect to buttons. Not an animation, strictly on/off effect.
Difficulty: Easy
Screenshot: Attached
Demo: http://www.forumwhatever.co.uk/forumdisplay.php?f=9

Why use it instead of an ordinary image mouseover? Well it does involve template changes unfortunately, but the biggest advantage is that it's a browser effect - aside from a few characters in your CSS it will use zero extra bandwidth over a static image. You can apply it to any button you want without having to create a new image, and it also means that you can universally change opacity levels per theme in a couple of seconds from one section of code without having to edit the image.

Opacity levels are controlled from the numbers in the code, you must change all three numbers to the same equivalent level so all browers display the effect the same. 1.0/100 is fully solid, down to 0.01/01 which is most opaque.


Instructions:
AdminCP > Style Manager > YourTheme > Go

Then in your Additional CSS Definitions add the following:

Code:
/* ***** Opacity 'fog' mouseover hack ***** */
.fog { opacity: 0.4; filter: alpha(opacity=40); -moz-opacity: 0.4; }
a:hover .fog { opacity: 1.0; filter: alpha(opacity=100); -moz-opacity: 1.0; }
If you want to use the effect on inline images such as the 'Go to last post' image, you'll also need to add this:
Code:
/* ***** Opacity 'fog' inline mouseover hack ***** */
.inlineimgfog { vertical-align: middle; opacity: 0.4; filter: alpha(opacity=40); -moz-opacity: 0.4;  }
a:hover .inlineimgfog { opacity: 1.0; filter: alpha(opacity=100); -moz-opacity: 1.0; }
The reason for this is that inline images already have a class assigned and we can't add another, so we combine the class definitions into one - inlineimagefog. For images without an existing class, use fog.

All you have to do is locate the image code in the template that you want to add the effect to, and either add class="fog" or change class="inlineimg" to class="inlineimgfog" where appropriate inside the img tag.

I applied the effect in the demo to last post, first new post, new reply and new thread buttons. The locations for template changes for these are below. You may of course use it on any hyperlinked image you wish.


New thread:
Code:
FORUMDISPLAY
newthread.gif - Line 52 - fog
newthread.gif - Line 135 - fog
New reply:
Code:
SHOWTHREAD
reply.gif - Line 25 - fog
reply.gif - fog - Line 109 - fog
Go to first new post:
Code:
THREADBIT
firstnew.gif - Line 20 - inlineimgfog
firstnew.gif - Line 33 - inlineimgfog
Code:
SHOWTHREAD
firstnew.gif - Line 40 - inlineimgfog
Go to last post:
Code:
FORUMDISPLAY_ANNOUNCEMENT
lastpost.gif - Line 5 - inlineimgfog
Code:
FORUMHOME_LASTPOSTBY
lastpost.gif - Line 12 - inlineimgfog
lastpost.gif - Line 18 - inlineimgfog
Done!

Show Your Support

  • This modification may not be copied, reproduced or published elsewhere without author's permission.

Comments
  #2  
Old 10-09-2005, 03:23 PM
TygerTyger TygerTyger is offline
 
Join Date: Aug 2005
Posts: 182
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

A note on the code:

Due to Internet Explorer and older versions of Mozilla using proprietary opacity code (Yes, Mozilla fanboys must hold their hands up too this time) this will break your CSS W3C compliance. It won't make any difference to the functioning of your page, you just won't be able to say it's compliant.

This is not necessarily the best version of image opacity code, but it is the most compatible. It will work in all current major browsers except Opera (lagging behind somewhat, but when they catch up you should be ready) and should degrade gracefully to around NN4 and IE4 (but don't hold me to it.) although it does mean you can only use it on hyperlinked images. There are other ways of doing this, but you'll lose the effect in some browsers, most notably IE which has the most trouble.

If anyone comes up with more widely compatible CSS I'll update to include it.
Reply With Quote
Reply

Thread Tools

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 03:49 AM.


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.03570 seconds
  • Memory Usage 2,206KB
  • Queries Executed 17 (?)
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
  • (8)bbcode_code
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)modsystem_post
  • (1)navbar
  • (6)navbar_link
  • (120)option
  • (2)post_thanks_box
  • (2)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (2)post_thanks_postbit_info
  • (1)postbit
  • (2)postbit_onlinestatus
  • (2)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_postinfo_query
  • fetch_postinfo
  • 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
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete