This is Interesting: Free Magazines for Graphics designers and webmasters  


Home > Archive > Dreamweaver > April 2004 > show/hide Layers modification





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author show/hide Layers modification
jerry_mx

2004-04-21, 3:09 pm

Hi all,

Since I recently modifies the MM_showHideLayers() function and it worked just
fine, I want to share it so people with the same problem as mine could rely on
it.

Enough said, the problem I encountered is that despite the "visible/hidden"
properties on the Layers, they still [i]ocuppy[/i] space on the page. BE if I
tried to put some resultSet into a table and hidding in from the user until a
mouseOver or mouseClick behavior, the <td> were populated and the table
displayed in a way that I didn?t want.

I found out that modifiying the function with the "inline/none" properties for
the layers the trick was done and the tables were displayed as if no data
populated the <td>'s.

Here is the code:

function DM_displayLayers() { //v1.0
var i,p,v,obj,args=DM_displayLayers.arguments;
for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) {
v=args[i+2];
if (obj.style) { obj=obj.style; v=(v=='on')?'inline':(v='off')?'none':v; }
obj.display=v; }
}

It works very similar to the MM_showhideLayer() function but accepts the "on"
/ "off" parameters instead of "show" /"hide". And requires MM_findObj.

Also found that the two fuctions can be applied to almost any object in an
html.

Greetings,

Jerry

Murray *TMM*

2004-04-21, 3:09 pm

Shouldn't it be display:block and display:none?

--
Murray --- ICQ 71997575
Team Macromedia Volunteer for Dreamweaver MX
(If you *MUST* email me, don't LAUGH when you do so!)
==================
news://forums.macromedia.com/macromedia.dreamweaver - THE BEST WAY TO GET
ANSWERS
==================
http://www.dreamweavermx-templates.com - Template Triage!
http://www.projectseven.com/go - DW FAQs, Tutorials & Resources
http://www.dwfaq.com - DW FAQs, Tutorials & Resources
http://www.macromedia.com/support/search/ - Macromedia (MM) Technotes
==================

"jerry_mx" <webforumsuser@macromedia.com> wrote in message
news:c645nd$97h$1@forums.macromedia.com...
> Hi all,
>
> Since I recently modifies the MM_showHideLayers() function and it worked

just
> fine, I want to share it so people with the same problem as mine could

rely on
> it.
>
> Enough said, the problem I encountered is that despite the

"visible/hidden"
> properties on the Layers, they still [i]ocuppy[/i] space on the page. BE

if I
> tried to put some resultSet into a table and hidding in from the user

until a
> mouseOver or mouseClick behavior, the <td> were populated and the table
> displayed in a way that I didn?t want.
>
> I found out that modifiying the function with the "inline/none"

properties for
> the layers the trick was done and the tables were displayed as if no data
> populated the <td>'s.
>
> Here is the code:
>
> function DM_displayLayers() { //v1.0
> var i,p,v,obj,args=DM_displayLayers.arguments;
> for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null)

{
> v=args[i+2];
> if (obj.style) { obj=obj.style;

v=(v=='on')?'inline':(v='off')?'none':v; }
> obj.display=v; }
> }
>
> It works very similar to the MM_showhideLayer() function but accepts the

"on"
> / "off" parameters instead of "show" /"hide". And requires MM_findObj.
>
> Also found that the two fuctions can be applied to almost any object in

an
> html.
>
> Greetings,
>
> Jerry
>



ranjan - dreamlettes

2004-04-21, 3:09 pm

Murray *TMM* wrote:
> Shouldn't it be display:block and display:none?
>


depends on if your target element is a block or inline element, eg img
->> display:none p --> display:block
Murray *TMM*

2004-04-21, 3:10 pm

In the case of the modifications posted, the only choices are inline and
none, meaning that it can only 'properly' be applied to inline elements -
that was my point.

To do it for divisions only, the 'inline' would have to be changed to
'block'.

--
Murray --- ICQ 71997575
Team Macromedia Volunteer for Dreamweaver MX
(If you *MUST* email me, don't LAUGH when you do so!)
==================
news://forums.macromedia.com/macromedia.dreamweaver - THE BEST WAY TO GET
ANSWERS
==================
http://www.dreamweavermx-templates.com - Template Triage!
http://www.projectseven.com/go - DW FAQs, Tutorials & Resources
http://www.dwfaq.com - DW FAQs, Tutorials & Resources
http://www.macromedia.com/support/search/ - Macromedia (MM) Technotes
==================

"ranjan - dreamlettes" <ranjan@DREAMSPAMdreamlettes.net> wrote in message
news:c64kj9$qmb$1@forums.macromedia.com...
> Murray *TMM* wrote:
>
> depends on if your target element is a block or inline element, eg img
> ->> display:none p --> display:block



rubbish

2004-04-21, 3:10 pm

Hi, I am a newbie to all this and would like to know more about the script you
taking about?

It seems to do, what I am trying to achieve? Could you point me in the
direction of a tutorial which explains what all the code does?

Thanks

Sponsored Links


Copyright 2003 - 2008 forum4designers.com  Software forum  Computer Hardware reviews