JavaScript DHTML/Ajax Layer/Layer Position

Материал из Web эксперт
Перейти к: навигация, поиск

RelativeLayers : Relative positioning example

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<!--
// RelativeLayers 0.9.7
// 
// $Id: example5.html 1.7 04/02/02 21:22:32+01:00 gbevin@willow.uwyn.office $
// 
// Library for creating dynamic designs that adapt themselves to the user"s
// browser environment.
// 
// Copyright (C) 1998-2004, Geert Bevin
// Distributed under the terms of the GNU Lesser General Public, v2.1 or later
// 
// gbevin[remove] at uwyn dot com
// http://www.uwyn.ru/projects/relativelayers
-->
<HTML>
<HEAD>
<TITLE>RelativeLayers : Relative positioning example</TITLE>
<SCRIPT LANGUAGE="JavaScript" SRC="rl_error_stripped.js"></SCRIPT>
<SCRIPT LANGUAGE="JavaScript" SRC="rl_browser_stripped.js"></SCRIPT>
<SCRIPT LANGUAGE="JavaScript1.2" SRC="rl_utility_stripped.js"></SCRIPT>
<SCRIPT LANGUAGE="JavaScript1.2" SRC="rl_window_stripped.js"></SCRIPT>
<SCRIPT LANGUAGE="JavaScript1.2" SRC="rl_layer_stripped.js"></SCRIPT>
<SCRIPT LANGUAGE="JavaScript1.2">
<!--
layer1 = new RelativeLayer(
"layer1Div", "", "",
"100%","20%",LEFT,"0",TOP,"0","-50%","-50%",
"100%","100%",LEFT,"50%",TOP,"50%","0","0",
"#dddddd");
layer1.setVisible(true);
layer2 = new RelativeLayer(
"layer2Div", "layer1Div", "layer1Div",
"30%","60%",LEFT,"0",BOTTOM,"0","-50%","-50%",
"100%","100%",LEFT,"50%",TOP,"50%","0","0",
"#99dd99");
layer2.setVisible(true);
layer3 = new RelativeLayer(
"layer3Div", "layer2Div", "layer2Div",
"100%-20","20%",LEFT,"0",BOTTOM,"0","-50%","-50%",
"100%","100%",LEFT,"50%",TOP,"50%","0","0",
"#dd9999");
layer3.setVisible(true);
layer4 = new RelativeLayer(
"layer4Div", "layer3Div", "layer3Div",
"30%-20","60%-20",RIGHT,"0",TOP,"0","50%","50%",
"100%","100%",LEFT,"50%",TOP,"50%","0","0",
"#9999dd");
layer4.setVisible(true);
//-->
</SCRIPT>
</HEAD>
<BODY BGCOLOR="#2F4078">
<DIV ID="layer1Div">
     Layer 1.<BR>
    <A HREF="javascript:layer1.visibleMoveBy(-10,0)">Left</A>
    <A HREF="javascript:layer1.visibleMoveBy(10,0)">Right</A>
    <A HREF="javascript:layer1.visibleMoveBy(0,-10)">Up</A>
    <A HREF="javascript:layer1.visibleMoveBy(0,10)">Down</A><BR>
    <A HREF="javascript:layer1.visibleResizeBy(0,"-10")">Shorter</A>
    <A HREF="javascript:layer1.visibleResizeBy(0,"10")">Longer</A><BR>
</DIV>
<DIV ID="layer2Div">
     Layer 2.<BR>
    <A HREF="javascript:layer2.visibleResizeBy("-10",0)">Narrower</A>
    <A HREF="javascript:layer2.visibleResizeBy("10",0)">Wider</A>
    <A HREF="javascript:layer2.visibleResizeBy(0,"-10")">Shorter</A>
    <A HREF="javascript:layer2.visibleResizeBy(0,"10")">Longer</A><BR>
</DIV>
<DIV ID="layer3Div">
     Layer 3.<BR>
    <A HREF="javascript:layer3.visibleResizeBy("-10",0)">Narrower</A>
    <A HREF="javascript:layer3.visibleResizeBy("10",0)">Wider</A>
    <A HREF="javascript:layer3.visibleResizeBy(0,"-10")">Shorter</A>
    <A HREF="javascript:layer3.visibleResizeBy(0,"10")">Longer</A><BR>
</DIV>
<DIV ID="layer4Div">
     Layer 4.<BR>
    <A HREF="javascript:layer4.visibleResizeBy("-10",0)">Narrower</A>
    <A HREF="javascript:layer4.visibleResizeBy("10",0)">Wider</A>
    <A HREF="javascript:layer4.visibleResizeBy(0,"-10")">Shorter</A>
    <A HREF="javascript:layer4.visibleResizeBy(0,"10")">Longer</A><BR>
</DIV>
</BODY>
</HTML>


<A href="http://www.wbex.ru/Code/JavaScriptDownload/relativelayers-0.9.7.zip">relativelayers-0.9.7.zip( 74 k)</a>


Slide layer to a position

http://dynapi.sourceforge.net/
GNU LESSER GENERAL PUBLIC LICENSE
Version 2.1, February 1999
<html>
<head>
<title>DynAPI Examples - DynLayer [Slide]</title>
<script language="JavaScript" src="./dynapisrc/dynapi.js"></script>
<script language="Javascript">
dynapi.library.setPath("./dynapisrc/");
dynapi.library.include("dynapi.api");
</script>
<script language="Javascript">
block = new DynLayer();
block.setSize(20,20);
block.setLocation(100,100);
block.setBgColor("red");
var listener = {};
listener.onpathstart = function(e) {
  status = "start";
}
listener.onpathrun = function(e) {
  var o = e.getSource();
  status = "play "+o.x+" "+o.y;
}
listener.onpathstop = function(e) {
  var o = e.getSource();
  status = "stop "+o.x+" "+o.y;;
}
block.addEventListener(listener);
dynapi.document.addChild(block);
//-->
</script>
</head>
<body bgcolor="#999999">
<script>
dynapi.document.insertAllChildren();
</script>
<p>SlideTo:
<br>(<a href="javascript:block.slideTo(100,100)">100,100</a>)
<br>(<a href="javascript:block.slideTo(200,100)">200,100</a>)
<br>(<a href="javascript:block.slideTo(200,200)">200,200</a>)
<br>(<a href="javascript:block.slideTo(100,200)">100,200</a>)
<br>(<a href="javascript:block.slideTo(400,50)">400,50</a>)
<br>(<a href="javascript:block.slideTo(50,400)">50,400</a>)

</body>
</html>


<A href="http://www.wbex.ru/Code/JavaScriptDownload/dynapi.zip">dynapi.zip( 791 k)</a>