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
Add Opacity to your images on mouse over with JavaScript Details »»
Add Opacity to your images on mouse over with JavaScript
Version: 1.00, by dxflw dxflw is offline
Developer Last Online: Aug 2010 Show Printable Version Email this Page

Category: Mini Mods - Version: 3.8.2 Rating:
Released: 06-03-2009 Last Update: Never Installs: 5
Template Edits
 
No support by the author.

Also this is my first code that i share with other users here in vbulletin.org

With this simple script you can change the opacity display to your images and looks with tech style.
I use this code to my homepage on vbadvanced modules but i think is not
hard to use it and like bbcode for images.

1) Only for adv_portal template:
Go to admincp/Style manager/choose your style<->expand style templates/Vbadvanced CMPS templates/adv_portal

find:

Code:
$footer
and bellow add this script..

Code:
<script language=JavaScript>
<!--
var itv = 50;
var step = 10;
var start = 0;
var end = 0;
var currentOpac;

//change the opacity for different browsers
function changeOpac(obj, opacity) {
	var object = obj.style; 
	object.opacity = (opacity / 100);
	object.MozOpacity = (opacity / 100);
	object.KhtmlOpacity = (opacity / 100);
	object.filter = "alpha(opacity=" + opacity + ")";
}

function BeginOpacity(obj, s, e)
{
	start = s;
	end = e;
	currentOpac = s;
	theobject=obj;
	changing=setInterval("opacityit(theobject)",itv);
}

function EndOpacity(obj, end){
	clearInterval(changing);
	changeOpac(obj, end);
}

function opacityit(obj){
	if(start > end) {
		if (currentOpac>end){
			currentOpac = currentOpac - step;
			changeOpac(obj,currentOpac);
		}
		else if (window.highlighting)
			clearInterval(highlighting);
	} else if(start < end) {
		if (currentOpac<end){
			currentOpac = currentOpac + step;
			changeOpac(obj,currentOpac);
		}
		else if (window.changing)
			clearInterval(changing);
	}
}
//-->
</script>
Now save the template.

2) Go admincp/vBa CMPS/Edit modules
Now if you have custome modules with images and you like to use the script you have only to add the code bellow to every image you like to display the script.

Add to every image you like the bellow code:

Code:
 style="FILTER: alpha(opacity=40);-moz-opacity: 0.4; opacity: 0.4;" 
onmouseover=BeginOpacity(this,40,100) onmouseout=EndOpacity(this,40)
in example:
Code:
<img src="your_image_path" width="100" height="100" border="0" 
style="FILTER: alpha(opacity=40);-moz-opacity: 0.4; opacity: 0.4;" 
onmouseover=BeginOpacity(this,40,100) onmouseout=EndOpacity(this,40)>
DEMO

Save and finish

Show Your Support

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

Comments
  #2  
Old 06-04-2009, 09:52 PM
TimberFloorAu's Avatar
TimberFloorAu TimberFloorAu is offline
 
Join Date: May 2008
Location: Brisbane
Posts: 2,264
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Looks cool. Not something I need, but good effort mate
Reply With Quote
  #3  
Old 06-04-2009, 11:01 PM
ArnyVee's Avatar
ArnyVee ArnyVee is offline
 
Join Date: Mar 2008
Posts: 944
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Nice work. Seems like there has to be another/easier way to pull this off though. But, looks very good on your site! :up:
Reply With Quote
  #4  
Old 06-05-2009, 07:25 AM
FreshFroot's Avatar
FreshFroot FreshFroot is offline
 
Join Date: Jul 2005
Posts: 770
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

nice work! love it!
Reply With Quote
  #5  
Old 06-05-2009, 01:50 PM
Wayne Luke's Avatar
Wayne Luke Wayne Luke is offline
Senior Member
 
Join Date: Jan 2002
Location: Southern California
Posts: 1,694
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by ArnyVee View Post
Nice work. Seems like there has to be another/easier way to pull this off though. But, looks very good on your site! :up:
Could use a technique as outlined here: http://vbcodex.com/showthread.php?t=73

Then you just need a unique CSS identifier and four lines of CSS code for your images to get similar effects.
Reply With Quote
  #6  
Old 06-05-2009, 02:07 PM
tlwwolfseye's Avatar
tlwwolfseye tlwwolfseye is offline
 
Join Date: Dec 2008
Location: Germany
Posts: 320
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

How would I have to adapt this to make it work for vBCms instead ?
Reply With Quote
  #7  
Old 06-06-2009, 12:55 AM
ArnyVee's Avatar
ArnyVee ArnyVee is offline
 
Join Date: Mar 2008
Posts: 944
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Wayne Luke View Post
Could use a technique as outlined here: http://vbcodex.com/showthread.php?t=73

Then you just need a unique CSS identifier and four lines of CSS code for your images to get similar effects.
Wow, seems simple on your explanation at the vBCodex.com site Wayne. So, I'm going to follow those instructions this weekend and see if I can get it to work

Thanks! :up:
Reply With Quote
  #8  
Old 06-06-2009, 01:53 PM
dxflw dxflw is offline
 
Join Date: May 2008
Posts: 218
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by tlwwolfseye View Post
How would I have to adapt this to make it work for vBCms instead ?
I never use cms so i have no idea about the templates of cms..
If any body knows about that will be great.:up:
Reply With Quote
  #9  
Old 06-10-2009, 11:32 PM
dazed12 dazed12 is offline
 
Join Date: Jul 2006
Posts: 30
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

it is very simple. all you have to do is put in headerinclude the javascript code. then insert the other code to the image src so it makes it work for just that image. this way you can do it for any image basically.
Reply With Quote
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 02:43 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.06121 seconds
  • Memory Usage 2,301KB
  • Queries Executed 25 (?)
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
  • (3)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)modsystem_post
  • (1)navbar
  • (4)navbar_link
  • (120)option
  • (9)post_thanks_box
  • (9)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (9)post_thanks_postbit_info
  • (8)postbit
  • (9)postbit_onlinestatus
  • (9)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