SOURCE CODE: Basic Marquee
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Basic Marquee | JavaScript Examples | UIZE JavaScript Framework</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<meta name="keywords" content="widget touch ipad Uize.Widget.Resizer.Marquee"/>
<meta name="description" content="See a basic example of the marquee widget in action. Some test links provided let you change some of the widget's configuration options dynamically."/>
<link rel="alternate" type="application/rss+xml" title="UIZE JavaScript Framework - Latest News" href="http://www.uize.com/latest-news.rss"/>
<link rel="stylesheet" href="../css/page.css"/>
<link rel="stylesheet" href="../css/page.example.css"/>
<style type="text/css">
input {
font-family:Courier;
font-size:12px;
width:30px;
height:15px;
}
</style>
</head>
<body>
<script type="text/javascript" src="../js/Uize.js"></script>
<h1 class="header">
<a id="page-homeLink" href="../index.html" title="UIZE JavaScript Framework home"></a>
<a href="../index.html" class="homeLinkText" title="UIZE JavaScript Framework home">UIZE JavaScript Framework</a>
</h1>
<div class="main">
<h1 class="document-title">
<a href="../javascript-examples.html" class="breadcrumb breadcrumbWithArrow">JAVASCRIPT EXAMPLES</a>
Basic Marquee
<div class="pageActionsShell">
<div id="page-actions" class="pageActions"><a href="source-code/marquee.html" class="buttonLink">SOURCE</a></div>
</div>
</h1>
<!-- explanation copy -->
<div class="explanation">
<p>In this basic example, an instance of <a href="../reference/Uize.Widget.Resizer.Marquee.html"><code>Uize.Widget.Resizer.Marquee</code></a> provides a very simple marquee widget. The marquee is configured so that it cannot be moved outside of its container node, by setting its <code>constrained</code> state property to <code>true</code>. It can be resized to an arbitrary aspect ratio, but it cannot be made smaller than 20x20, accomplished by setting the <code>minWidth</code> and <code>minHeight</code> state properties. A handler is registered for the <code>Position Changed</code> instance event, so that the coordinates of the marquee are displayed (in text inputs to the right) as you move and resize it. Additionally, a new marquee can be created by clicking and dragging in a fresh spot outside the marquee's current area.</p>
</div>
<!-- marquee UI wireframe -->
<div id="page_marquee" style="width:600px; height:240px; position:relative; margin:auto; margin-bottom:10px;" class="insetBackgroundColor"></div>
<div class="programmaticInterface">
<ul>
<li>Current Position:
LEFT: <span id="page-marqueePositionLeft"></span>
|
TOP: <span id="page-marqueePositionTop"></span>
|
WIDTH: <span id="page-marqueePositionWidth"></span>
|
HEIGHT: <span id="page-marqueePositionHeight"></span>
</li>
<li>Resizing Configurations
<ul>
<li>
FIXED WIDTH: <a href="javascript://" class="linkedJs">marquee.set ({fixedX:true,fixedY:false})</a>
|
FIXED HEIGHT: <a href="javascript://" class="linkedJs">marquee.set ({fixedX:false,fixedY:true})</a>
</li>
<li>
NOT RESIZABLE: <a href="javascript://" class="linkedJs">marquee.set ({fixedX:true,fixedY:true})</a>
|
FULLY RESIZABLE: <a href="javascript://" class="linkedJs">marquee.set ({fixedX:false,fixedY:false})</a>
</li>
</ul>
</li>
<li>Different Sizes:
<a href="javascript://" class="linkedJs">marquee.set ({width:50,height:50})</a>
|
<a href="javascript://" class="linkedJs">marquee.set ({width:100,height:100})</a>
|
<a href="javascript://" class="linkedJs">marquee.set ({width:300,height:50})</a>
</li>
<li>Nudge Horizontally:
LEFT: <a href="javascript://" class="linkedJs">marquee.set ({left:marquee.get ('left') - 10})</a>
|
RIGHT: <a href="javascript://" class="linkedJs">marquee.set ({left:marquee.get ('left') + 10})</a>
</li>
<li>Nudge Vertically:
UP: <a href="javascript://" class="linkedJs">marquee.set ({top:marquee.get ('top') - 10})</a>
|
DOWN: <a href="javascript://" class="linkedJs">marquee.set ({top:marquee.get ('top') + 10})</a>
</li>
</ul>
</div>
</div>
<!-- JavaScript code to make the static marquee HTML "come alive" -->
<script type="text/javascript">
Uize.require (
[
'UizeSite.Page.Example.library',
'UizeSite.Page.Example',
'Uize.Widget.Resizer.Marquee'
],
function () {
'use strict';
/*** create the example page widget ***/
var page = window.page = UizeSite.Page.Example ({evaluator:function (code) {eval (code)}});
/*** add the marquee child widget ***/
var marquee = page.addChild (
'marquee',
Uize.Widget.Resizer.Marquee,
{
//hideOtherHandlesInDrag:true,
constrain:true,
minWidth:20,
minHeight:20,
built:false
})
;
/*** display marquee position while dragging ***/
function displayMarqueePosition () {
page.setNodeValue ('marqueePositionLeft',marquee.get ('left'));
page.setNodeValue ('marqueePositionTop',marquee.get ('top'));
page.setNodeValue ('marqueePositionWidth',marquee.get ('width'));
page.setNodeValue ('marqueePositionHeight',marquee.get ('height'));
}
marquee.wire ('Position Changed',displayMarqueePosition);
/*** display marquee's initial position ***/
displayMarqueePosition ();
/*** wire up the page widget ***/
page.wireUi ();
}
);
</script>
</body>
</html>