Hi,

I added a setOpacity(0-100) method to the DynLayer ("inspired" by fader.js)
Works on IE (tested 6+ on WinXP) and DOM (tested Mozilla 1.6b on WinXP).

Comments (and commits ;) are welcome.

Regards
Peter



Index: src/api/dynlayer_base.js
===================================================================
RCS file: /cvsroot/dynapi/dynapi3x/src/api/dynlayer_base.js,v
retrieving revision 1.21
diff -u -r1.21 dynlayer_base.js
--- src/api/dynlayer_base.js    12 Oct 2003 19:58:12 -0000      1.21
+++ src/api/dynlayer_base.js    8 Jan 2004 00:57:30 -0000
@@ -393,4 +393,8 @@
                this.setLocation(endx,endy);
                this.invokeEvent('pathfinish');
        }
-};
\ No newline at end of file
+};
+
+// Default method - does nothing
+// opac = 0-100
+p.setOpacity=function(opac) {}
\ No newline at end of file
Index: src/api/dynlayer_dom.js
===================================================================
RCS file: /cvsroot/dynapi/dynapi3x/src/api/dynlayer_dom.js,v
retrieving revision 1.13
diff -u -r1.13 dynlayer_dom.js
--- src/api/dynlayer_dom.js     12 Oct 2003 19:58:12 -0000      1.13
+++ src/api/dynlayer_dom.js     8 Jan 2004 00:57:31 -0000
@@ -147,3 +147,9 @@
                return h;
        }
 };
+// opac 0-100
+p.setOpacity=function(opac) {
+    if (opac > 100) opac = 100;
+    if (opac < 0) opac = 0;
+    this.css.MozOpacity = parseInt(opac)/100;
+}
\ No newline at end of file
Index: src/api/dynlayer_ie.js
===================================================================
RCS file: /cvsroot/dynapi/dynapi3x/src/api/dynlayer_ie.js,v
retrieving revision 1.17
diff -u -r1.17 dynlayer_ie.js
--- src/api/dynlayer_ie.js      12 Oct 2003 19:58:12 -0000      1.17
+++ src/api/dynlayer_ie.js      8 Jan 2004 00:57:31 -0000
@@ -170,3 +170,9 @@
                
        }
 };
+// opac 0-100
+p.setOpacity=function(opac) {
+    if (opac > 100) opac = 100;
+    if (opac < 0) opac = 0;
+    this.css.filter='alpha(opacity=' + opac + ')';
+}
\ No newline at end of file



-------------------------------------------------------
This SF.net email is sponsored by: Perforce Software.
Perforce is the Fast Software Configuration Management System offering
advanced branching capabilities and atomic changes on 50+ platforms.
Free Eval! http://www.perforce.com/perforce/loadprog.html
_______________________________________________
Dynapi-Dev mailing list
[EMAIL PROTECTED]
http://www.mail-archive.com/[EMAIL PROTECTED]/

Reply via email to