Back To Start Of Archive
Taken From The Forum: Help & Support for DHTML Menu Version 5+
Forum Topic: Click to view post
Last Updated: Saturday July 14 2012 - 06:07:54
Setting Alpha filters for a menu item? and manipulating them
Poster: cubefree
Dated: Saturday November 29 2003 - 15:58:53 GMT
I know about the overfilter attribute, however that controls the alpha filters for an entire menu.
Is there a way to control alpha filters for a single menu item cell?
Is there a way to set it from the get-go without using onfunction/offfunction attibutes?
I am experimenting with the following code for opacity changes...
Code:
function changeOpacity( objID, opacity )
{
document.all[objID].style.filter = "progid:DXImageTransform.Microsoft.Alpha(opacity=" + opacity + ");";
}
{
document.all[objID].style.filter = "progid:DXImageTransform.Microsoft.Alpha(opacity=" + opacity + ");";
}
but the question remains how to identify the cell of the menu.
I have some other code I've got working to manipulate a table cell, but it needs some work.
Code:
var apl = new Array();
apl[0] = new Array(65,"");
apl[1] = new Array(65,"");
apl[2] = new Array(65,"");
apl[3] = new Array(65,"");
// Opacity variables and function
nOpac = 50
nPlus = 2
nMin = 1
speed = 30
timer = null;
timer2 = null;
function topfadein(teller)
{
apl[teller][1] = "Up";
topchanges();
}
function topfadeout(teller)
{
apl[teller][1] = "Down";
setTimeout("topchanges()",50);
}
function topchanges()
{
next_loop = true;
for (i=0;i<apl.length;i++)
{
obj = main.rows[0].cells[i];
opacity = apl[i][0]
if (apl[i][1] == "Up")
{
opacity += nPlus;
apl[i][0] = opacity;
if (apl[i][0] > 105)
{apl[i][1] = "";}
else
{next_loop = false;}
nOpac = opacity;
}
else
{
if (apl[i][1] == "Down")
{
opacity -= nMin;
apl[i][0] = opacity;
if (apl[i][0] < 65)
{apl[i][1] = "";}
else
{next_loop = false;}
nOpac = opacity;
}
}
if(ie5){
obj.style.filter="alpha(opacity="+opacity+")";
}
if(ns6){
obj.style.MozOpacity = opacity + '%';
}
}
if (next_loop == false)
{
timer = setTimeout("topchanges()",speed);
}
else
{
clearTimeout(timer);
}
}
You can see that code in action at http://www.cubefree.com ( the milonic menu is not yet activated on this site tho)[/b]
Poster: cubefree
Dated: Monday December 15 2003 - 19:06:14 GMT
Sorry to reply to my own post... but the length of my message requires a new post.
You can see my acceptable solution here: http://www.cubefree.com/menu.htm
Here's a reply from Andy:
Quote:
> Yes, the variable _itemRef is the currently selected item id and is global. Take a look at http://www.milonic.com/menusample.php?sampleid=15
AND
Try this.
function changeOpacity( objID, opacity )
{
var obj = gmobj("el"+objID);
obj.style.filter =
"progid:DXImageTransform.Microsoft.Alpha(opacity=" + opacity + ");";
}
AND
Try this.
function changeOpacity( objID, opacity )
{
var obj = gmobj("el"+objID);
obj.style.filter =
"progid:DXImageTransform.Microsoft.Alpha(opacity=" + opacity + ");";
}
I was still getting the following error trying to manipulate the opacity of an entire cell:
> Line: 17
> Char: 8672
> Error:'_m[...].23' is null or not an object
So, I manipulated the image only in the horizontial nav.
Here's the code I used:
Code:
// Opacity variables and function
var nPlus = 2;
var nMin = 3;
var speed = 10;
var timer = null;
var timer2 = null;
function changeOpacityUp( objID, zOpacity )
{
nOpac = 65;
upObj = gmobj(objID);
direction = "Up";
fadeUp();
}
function changeOpacityDown( objID, zOpacity )
{
dOpac = 65;
downObj = gmobj(objID);
direction = "Down";
setTimeout("fadeDown()", 50);
}
function fadeUp()
{
//alert(nOpac);
next_loop = true;
opacity = nOpac;
if (direction == "Up")
{
opacity += nPlus;
nOpac = opacity;
if (nOpac > 105)
{direction = "";}
else
{next_loop = false;}
nOpac = opacity;
}
if(document.all && document.getElementById){
upObj.filters.item("DXImageTransform.Microsoft.Alpha").opacity = opacity;
}
if(document.getElementById && !document.all){
//obj.style.MozOpacity = opacity + '%';
}
if (next_loop == false)
{
timer = setTimeout("fadeUp()",speed);
}
else
{
// alert("timer cleared");
clearTimeout(timer);
}
}
function fadeDown()
{
next_loop = true;
opacity = dOpac;
if (direction == "Down")
{
opacity -= nMin;
dOpac = opacity;
if (dOpac < 65)
{ direction = ""; }
else
{ next_loop = false; }
dOpac = opacity;
}
if(document.all && document.getElementById){
downObj.filters.item("DXImageTransform.Microsoft.Alpha").opacity = opacity;
}
if(document.getElementById && !document.all){
//obj.style.MozOpacity = opacity + '%';
}
if (next_loop == false)
{
timer2 = setTimeout("fadeDown()",speed);
}
else
{
//alert("timer2 cleared and loop = " + next_loop);
clearTimeout(timer2);
}
}
var nPlus = 2;
var nMin = 3;
var speed = 10;
var timer = null;
var timer2 = null;
function changeOpacityUp( objID, zOpacity )
{
nOpac = 65;
upObj = gmobj(objID);
direction = "Up";
fadeUp();
}
function changeOpacityDown( objID, zOpacity )
{
dOpac = 65;
downObj = gmobj(objID);
direction = "Down";
setTimeout("fadeDown()", 50);
}
function fadeUp()
{
//alert(nOpac);
next_loop = true;
opacity = nOpac;
if (direction == "Up")
{
opacity += nPlus;
nOpac = opacity;
if (nOpac > 105)
{direction = "";}
else
{next_loop = false;}
nOpac = opacity;
}
if(document.all && document.getElementById){
upObj.filters.item("DXImageTransform.Microsoft.Alpha").opacity = opacity;
}
if(document.getElementById && !document.all){
//obj.style.MozOpacity = opacity + '%';
}
if (next_loop == false)
{
timer = setTimeout("fadeUp()",speed);
}
else
{
// alert("timer cleared");
clearTimeout(timer);
}
}
function fadeDown()
{
next_loop = true;
opacity = dOpac;
if (direction == "Down")
{
opacity -= nMin;
dOpac = opacity;
if (dOpac < 65)
{ direction = ""; }
else
{ next_loop = false; }
dOpac = opacity;
}
if(document.all && document.getElementById){
downObj.filters.item("DXImageTransform.Microsoft.Alpha").opacity = opacity;
}
if(document.getElementById && !document.all){
//obj.style.MozOpacity = opacity + '%';
}
if (next_loop == false)
{
timer2 = setTimeout("fadeDown()",speed);
}
else
{
//alert("timer2 cleared and loop = " + next_loop);
clearTimeout(timer2);
}
}
Ok, hope someone else has some ideas on how to manipulate the cell itself.
Thx
Cubeman
Industrial Strength JavaScript and DHTML Menus
About Us
Testimonials
Contact Us
Our Distinguished Clients
Investing in Non-Profits
Where Are We
Privacy Policy
Software Licensing Agreement
DHTML JavaScript Menu
Product Information
Page Integration
Quick Reference Guides
Embedding Into a Table or DIV
Purchase
