Webmaster Forum


Go Back   Webmaster Forum > Web Development > Web Design Lobby > Coding Forum
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

Coding Forum Problems with your code? Let's hear about it.

   

Reply
 
LinkBack Thread Tools Display Modes
Old 06-10-2007, 10:09 AM   #1 (permalink)
Inactive
 
nster's Avatar
 
Join Date: 11-06-06
Posts: 16
iTrader: 0 / 0%
Latest Blog:
None

nster is liked by many
Question Javascript - i cant get Opacity with Opera ! plz help !??

hello everybody ,

Am using this javascript

in order to achive Opacity according to the browser that the user uses .

The problem is that works perfect in Mozzila FX and MS I. Explorer ..but dosent work in OPERA !! why ?

Please can you show me how to make it work also with Opera browsers ?

i try as follow..

opera = (document.all && document.getElementById);
and
if(opera) document.getElementById('fadeL').style.opacity = (opacity/100) ;

but yet not success with opera..


Code:
<script language="JavaScript"> ie5 = (document.all && document.getElementById); ns6 = (!document.all && document.getElementById); opera = (document.all && document.getElementById); opac3 = 0; function opacIn() { if(opac3 < 100){ opac3+=5; if(ie5) document.getElementById('fadeL').filters.alpha.opacity = opac3; if(ns6) document.getElementById('fadeL').style.MozOpacity = opac3/100; if(opera) document.getElementById('fadeL').style.opacity = (opacity/100) ; setTimeout('opacIn()', 50); }else{ opacOut(); } } function opacOut() { if(opac3 > 0){ opac3-=5; if(ie5) document.getElementById('fadeL').filters.alpha.opacity = opac3; if(ns6) document.getElementById('fadeL').style.MozOpacity = opac3/100; if(opera) document.getElementById('fadeL').style.opacity = (opacity/100) ; setTimeout('opacOut()', 50); }else{ opacIn(); } } </script>
..am waiting for you help on it . i stuck
nster is offline  
Add Post to del.icio.us
Reply With Quote
Old 06-10-2007, 10:52 AM   #2 (permalink)
v7n Mentor
 
Costin Trifan's Avatar
 
Join Date: 04-13-07
Location: Romania
Posts: 3,009
iTrader: 0 / 0%
Costin Trifan is a highly respected web proCostin Trifan is a highly respected web proCostin Trifan is a highly respected web proCostin Trifan is a highly respected web proCostin Trifan is a highly respected web proCostin Trifan is a highly respected web proCostin Trifan is a highly respected web proCostin Trifan is a highly respected web proCostin Trifan is a highly respected web proCostin Trifan is a highly respected web proCostin Trifan is a highly respected web pro
I had a look here: http://www.opera.com/support/search/view/729/

and then to your code

The problem seems to be with your code:

Quote:
if(ie5) document.getElementById('fadeL').filters.alpha.opacity = opac3;
it shoud be
Quote:
if(ie5) document.getElementById('fadeL').filter.alpha.opacity = opac3;
hth
Costin Trifan is offline  
Add Post to del.icio.us
Reply With Quote
Old 06-10-2007, 11:41 AM   #3 (permalink)
Inactive
 
nster's Avatar
 
Join Date: 11-06-06
Posts: 16
iTrader: 0 / 0%
Latest Blog:
None

nster is liked by many
you are wrong,

the way you told me it is not correct !

if i delete -s and i use filter and not filters ..then even in IE dosent work ! either in Opera as before..

you tried it ? cause i tried it as you told me and IE & Opera do so show anything then..

so ?
nster is offline  
Add Post to del.icio.us
Reply With Quote
Old 06-10-2007, 07:04 PM   #4 (permalink)
v7n Mentor
 
Costin Trifan's Avatar
 
Join Date: 04-13-07
Location: Romania
Posts: 3,009
iTrader: 0 / 0%
Costin Trifan is a highly respected web proCostin Trifan is a highly respected web proCostin Trifan is a highly respected web proCostin Trifan is a highly respected web proCostin Trifan is a highly respected web proCostin Trifan is a highly respected web proCostin Trifan is a highly respected web proCostin Trifan is a highly respected web proCostin Trifan is a highly respected web proCostin Trifan is a highly respected web proCostin Trifan is a highly respected web pro
I might be wrong here...
Costin Trifan is offline  
Add Post to del.icio.us
Reply With Quote
Old 06-11-2007, 11:41 PM   #5 (permalink)
Inactive
 
Join Date: 05-06-07
Posts: 85
iTrader: 0 / 0%
Latest Blog:
None

alainkun is a jewel in the roughalainkun is a jewel in the roughalainkun is a jewel in the roughalainkun is a jewel in the roughalainkun is a jewel in the roughalainkun is a jewel in the roughalainkun is a jewel in the rough
Send a message via MSN to alainkun
I dont know lot of Javascript, but I was looking and you can detectec opera users with this javascript code:

if(navigator.userAgent.indexOf("Opera")!=-1)
alainkun is offline  
Add Post to del.icio.us
Reply With Quote
Old 09-11-2008, 07:00 PM   #6 (permalink)
Junior Member
 
Join Date: 09-11-08
Posts: 1
iTrader: 0 / 0%
Latest Blog:
None

Spoofy is liked by many
Hi nster, havent really seen opacity filter style applied that way in IE, but when using for IE specific browsers i use the following to set an object's opacity instead:
obj.style.filter = 'alpha(opacity=<value>)';

So for your script it should be:
if(ie5) document.getElementById('fadeL').filter = 'alpha(opacity= ' + opac3 + ')';

Also not sure why you are using browser detection for this each time, you could just set the filter, opacity and MozOpacity all at the same time without conditional testing and wont produce any errors. Your IE and Opera detection are looking for the same thing?
Spoofy is offline  
Add Post to del.icio.us
Reply With Quote
Go Back   Webmaster Forum > Web Development > Web Design Lobby > Coding Forum

Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Set opacity with JS Izzmo Coding Forum 3 01-05-2007 08:36 PM
Opera keep caching JavaScript noob78 Coding Forum 11 09-09-2006 01:02 AM
Opera and SevenSeek Jazzee Forum Lobby 24 08-25-2005 08:30 AM
Count-up from a particular year + Javascript within Javascript? Help! Azam.biz Coding Forum 3 06-06-2005 07:47 AM


Sponsor Links
Get exposure! Get exposure! Find Scripts Web Hosting Directory Get exposure! SEO Blog


All times are GMT -7. The time now is 10:38 AM.
© Copyright 2008 V7 Inc