473,405 Members | 2,262 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

Cross Browser image transitions

Dan
Hi,

I was wondering if anyone could come up with a cross browser image
transition that I could use... I have already made one that works in IE
but i know it doesn't work in Mozilla Firefox.

Below is the script I have made, there is only one error with it
(besides compatabilty), the fact that you can make the images
transition even when there is already a transition occuring, I have
tried to compensate for this, but it doesn't work... if someone could
help me with this aswell it would be appreciated.

<html>
<head>
<title>Image Transitions</title>

<SCRIPT language="JavaScript">
var imgtran = "blendTrans(duration=5)";
var urla=new Array("Raptor.jpg","Aurora.jpg");
var trana=new Array("","");
var disa=new Array("Red Image","Blue Image")

function tran(imgtran) {

if(imgtran == ""){
var imgtran = "blendTrans(duration=5)";
}

var imgname = document.getElementById("img").name;

if(imgname == "blue"){
oDiv.style.filter=imgtran;
// Make sure the filter is not playing.
// This is the part of the script that does not work
if (oDiv.filters[0].status != 2) {
oDiv.filters[0].apply();
document.getElementById("img").bgColor = "#FF0000";
document.getElementById("img").name = "red";
oDiv.filters[0].play();
}
}
if(imgname == "red"){
oDiv.style.filter=imgtran;
// Make sure the filter is not playing.
// This is the part of the script that does not work
if (oDiv.filters[0].status != 2) {
oDiv.filters[0].apply();
document.getElementById("img").bgColor = "#0000FF";
document.getElementById("img").name = "blue";
oDiv.filters[0].play();
}
}
}
</SCRIPT>
</head>
<body>
<DIV ID="oDiv" style="width:200;height:200;">
<table width="200" name="blue" id="img" height="200" border="0"
bgcolor="#0000FF">
<tr>
<td></td>
</tr>
</table>
</DIV>
<BUTTON
onclick="tran(document.getElementById('select').va lue)">Transition</BUTTON>
<select id="select" onchange="tran(this.value)">
<option value="" selected>select transition</a>
<option value="blendTrans(duration=5)">blend</option>
<option value="revealTrans(transition=0,duration=5)">0:box in</option>
<option value="revealTrans(transition=1,duration=5)">1:box out</option>
<option value="revealTrans(transition=2,duration=5)">2:cir cle
in</option>
<option value="revealTrans(transition=3,duration=5)">3:cir cle
out</option>
<option value="revealTrans(transition=4,duration=5)">4:wip e up</option>
<option value="revealTrans(transition=5,duration=5)">5:wip e
down</option>
<option value="revealTrans(transition=7,duration=5)">7:wip e
left</option>
<option value="revealTrans(transition=8,duration=5)">8:ver tical
blinds</option>
<option value="revealTrans(transition=9,duration=5)">9:hor izontal
blinds</option>
<option value="revealTrans(transition=10,duration=5)">10:c heckerboard
across</option>
<option value="revealTrans(transition=11,duration=5)">11:c heckerboard
down</option>
<option
value="revealTrans(transition=12,duration=5)">12:d issolve</option>
<option value="revealTrans(transition=13,duration=5)">13:s plit-in
vertical</option>
<option value="revealTrans(transition=14,duration=5)">14:s plit-out
vertical</option>
<option value="revealTrans(transition=15,duration=5)">15:s plit-in
horizontal</option>
<option value="revealTrans(transition=16,duration=5)">16:s plit-out
horizontal</option>
<option value="revealTrans(transition=17,duration=5)">17:s trips-down
left</option>
<option value="revealTrans(transition=18,duration=5)">18:s trips-up
left</option>
<option value="revealTrans(transition=19,duration=5)">19:s trips-down
right</option>
<option value="revealTrans(transition=20,duration=5)">20:s trips-up
right</option>
<option value="revealTrans(transition=21,duration=5)">21:r andom
horizontal bars</option>
<option value="revealTrans(transition=22,duration=5)">22:r andom
vertical bars</option>
<option
value="revealTrans(transition=23,duration=5)">23:r andom</option>
</select>
</div>
</body>
</html>

If anyone could help me with these problems it would be very much
appreciated!

Thanks

Dan

Feb 25 '06 #1
1 3131

Dan wrote:
Hi,

I was wondering if anyone could come up with a cross browser image
transition that I could use... I have already made one that works in IE
but i know it doesn't work in Mozilla Firefox.

Below is the script I have made, there is only one error with it
(besides compatabilty), the fact that you can make the images
transition even when there is already a transition occuring, I have
tried to compensate for this, but it doesn't work... if someone could
help me with this aswell it would be appreciated.


I believe that IE and old WebTV were about the only browsers that had
built in transistions. IE has several filters, but these, for the most
part, are not supported by other browsers. You might find some image
transition effect that you like at http://www.dynamicdrive.com that is
based on script written to work on most common browsers.

However the best way to do for this sort of thing is to write the page
in SMIL 2. SMIL is an XML language that is designed for media
presentations and has all sorts of built in transitions, fades, etc.,
and everything can be timed precisely. Most browsers do not support W3C
SMIL 2 yet. However the recent Real players have nearly complete
support of SMIL built in. Thus if you have the Real player, it does not
matter what browser you have on your computer. I have a SMIL demo page
that illustrates some motion effects, transitions, fades, etc using
images, videos, and music. SMIL really is a very powerful language for
media. Go to http://www.cwdjr.info/media/playersRoot.php and select the
link REAL(SMIL) at the top of the page if you have a recent Real
player.

Of course when you use elaborate media effects, you can not expect
everyone to see them. The viewer may not have a needed player
installed, they may have javascript turned off, etc. Thus you need to
write the code so that the page degrades gracefully if something is
missing on the viewing browser.

Feb 25 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Julia Briggs | last post by:
Is there a <a href="javasc... approach to switch between two images inside a div tag so it doesn't slightly flicker when clicked on, and transitions between images smoothly in Netscape? I can get...
1
by: cjl | last post by:
Hey all: I'm trying to write a cross-browser (IE and firefox) event handler for the mousewheel. Basically my web app is an image viewer, so if you scroll "down" with the wheel the next image...
3
by: tommy_razz | last post by:
is there a good method to fade image in a simple way in a server control without using flash or other proprietor software ?
2
by: rbanerji | last post by:
I am building a BHO that is meant to popup a IHtmlPopup window on a mouse over image event. All the code works fine if the image is in the main Window. However if the image is in a frame then I...
2
by: tascien | last post by:
question I have never been able to solve since the 90s... I want to find x, y location of a layer or an image, or any other item on a webpage. 1. It could be relatively or absolutely...
2
NoPeasHear
by: NoPeasHear | last post by:
I'm afraid of the answer I am going to get. I am working on my website on a Mac, and I don't know anything about making things work cross browser. Please dumb it down for me. One of the...
2
by: mattgarvin | last post by:
Hello, I need a piece of javascript that will allow a form to be submitted when Enter is pressed for IE6 and 7, Firefox 2, and recent versions of Safari. It is for a login page that has two...
13
by: Jeff | last post by:
We have an intranet website that currently uses ActiveX but we need to make it cross-browser compatible and also get around the problems we've been having with making it work with IE7 and Vista. We...
16
by: Stevo | last post by:
I'm guessing this is a laughably obvious answer to many here, but it's not to me (and I don't have a server or any knowledge of PHP to be able to try it). It's not strictly a PHP question, but...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.