Hi there,
I did a bit of Googling and found a function that does what you want.
Here's a working example with the code you provided:
HTML Code:
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Image fade in example</title>
</head>
<body>
<div>
<a href="#26" onclick="num26()"><input type="button" value="photo" class="buttonIfmar"></a>
<span id="num26"></span>
<p>text is here</p>
</div>
<script>
function appear(elm, i, steps, speed){
var t_o;
i = i || 0;
steps = steps || 5;
speed = speed || 50;
t_o = setInterval(function(){
opacity = i / 100;
i = i + steps;
if(opacity > 1 || opacity < 0){
clearInterval(t_o);
return;
}
elm.style.opacity = opacity;
elm.style.filter = 'alpha(opacity=' + opacity*100 + ')';
}, speed);
}
function num26() {
document.getElementById('num26').innerHTML = '<a href="#num26" onclick="displayNone()" alt=""><input type="button" value="close" class="closeButton"></a>' + '<img src="photo.jpg" width="350px" style="clear:both;"><br>';
appear(document.getElementById('num26'), 0, 5, 40);
}
function displayNone() {
appear(document.getElementById('num26'), 100, -5, 40);
setTimeout(function(){ document.getElementById('num26').innerHTML = '';}, 700)
}
</script>
</body>
</html>
I found the function here: http://stackoverflow.com/questions/2...ing-javascript
If you look at the page in question, it is explained a little more.
HTH
Bookmarks