X Library Viewer

Download the X Distribution File.

X Index

Animation

xAniLine, xAnimation.arc, xAnimation.corner, xAnimation.css, xAnimation.imgSize, xAnimation.line, xAnimation.opacity, xAnimation.para, xAnimation.rgb, xAnimation.rgbByClass, xAnimation.scroll, xAnimation.size, xAnimation, xAniOpacity, xAniRgb, xAniWH, xAniXY, xEllipse, xParaEq, xSequence, xSlideCornerTo, xSlideTo, xWinScrollTo.

DOM

xFirstChild, xGetElementById, xGetElementsByAttribute, xGetElementsByClassName, xGetElementsByTagName, xLoadLink, xLoadScript, xNextSib, xParent, xParentN, xPrevSib, xSmartLoad, xSmartLoad2, xSmartLoadScript.

Debug

xConsole, xEditable, xName, xParentChain, xSetIETitle.

Event

xAddEventListener, xDisableDrag, xDisableDrop, xEnableDrag, xEnableDrag2, xEnableDrop, xEvent, xHttpRequest, xPreventDefault, xRemoveEventListener, xStopPropagation.

Image

xImgAsyncWait, xImgRollSetup, xTriStateImage.

Iteration

xEach, xEachE, xEachN, xEachUntilReturn, xTimes, xWalkToFirst, xWalkToLast, xWalkTree, xWalkTree2, xWalkTree3, xWalkTreeRev, xWalkUL.

Misc

xCookie, xDef, xDeg, xGetURLArguments, xLibrary, xLinearScale, xNum, xRad, xRound, xStr.

Position

xCardinalPosition, xCen, xCenter, xGetEleAtPoint, xHasPoint, xIntersection, xLeft, xMoveTo, xOffset, xPageX, xPageY, xScrollLeft, xScrollTop, xTop.

Size

xClip, xColEqualizer, xDocSize, xHeight, xResizeTo, xWidth.

String

xCamelize, xCapitalize, xHex, xPad, xParseColor, xRgbToHex, xStrEndsWith, xStrRepeat, xStrReplaceEnd, xStrStartsWith, xTrim.

Style

xAddClass, xDisplay, xFindAfterByClassName, xFindBeforeByClassName, xGetComputedStyle, xGetCSSRules, xGetStyleSheetFromLink, xHasClass, xHasStyleSelector, xHasStyleSheets, xInsertRule, xOpacity, xRemoveClass, xStyle, xTagStyle, xToggleClass, xTraverseDocumentStyleSheets, xTraverseStyleSheet.

Table

xTable, xTableCellVisibility, xTableColDisplay, xTableCursor, xTableCursor2, xTableHeaderFixed, xTableIterate, xTableRowDisplay, xTableSync.

UI

xBar, xCalendar, xCollapsible, xDialog, xFenster, xFenster2, xMenu1, xMenu1A, xMenu1B, xMenu5, xMenu6, xModalDialog, xPopup, xSelect, xSplitter, xTabPanelGroup, xTextArea, xTooltipGroup.

Window

xClientHeight, xClientWidth, xWinClass, xWindow, xWinOpen.

xSequence

Description

xSequence is an experiment with time and event based sequences.

Syntax

obj = new xSequence(seq)

Parameters

seqA Sequence is an array of Action arrays. See the demo for details.

Source

Default.

// xSequence r1, Copyright 2001-2007 Michael Foster (Cross-Browser.com)
// Part of X, a Cross-Browser Javascript Library, Distributed under the terms of the GNU LGPL
function xSequence(seq) // object prototype
{
  // Private Properties
  var ai = 0; // current action index of seq
  var stop = true;
  var running = false;
  // Private Method
  function runSeq()
  {
    if (stop) {
      running = false;
      return;
    }
    if (this.onslideend) this.onslideend = null; // during a slideend callback
    if (ai >= seq.length) ai = 0;
    var i = ai;
    ++ai;
    if (seq[i][0] != -1) {
      setTimeout(runSeq, seq[i][0]);
    }
    else {
      if (seq[i][2] && seq[i][2][0]) seq[i][2][0].onslideend = runSeq;
    }
    if (seq[i][1]) {
      if (seq[i][2]) seq[i][1].apply(window, seq[i][2]);
      else seq[i][1]();
    }
  }
  // Public Methods
  this.run = function(si)
  {
    if (!running) {
      if (xDef(si) && si >=0 && si < seq.length) ai = si;
      stop = false;
      running = true;
      runSeq();
    }
  };
  this.stop = function()
  {
    stop = true;
  };
  this.onUnload = function() // is this needed? do I have circular refs?
  {                          // this should already have been done above, don't think it's needed
    if (!window.opera) {
      for (var i=0; i<seq.length; ++i) {
        if (seq[i][2] && seq[i][2][0] && seq[i][2][0].onslideend) seq[i][2][0].onslideend = runSeq;
      }
    }
  };
}

Public Methods

run(seqIndex)
stop
onUnload

Demos

xsequence - This demo illustrates usage.

Notes

19Oct06 A Sequence is an array of Action arrays: seq[0] = first action seq[i][0] = time to next action, or if -1 then wait for onslideend seq[i][1] = function ref seq[i][2] = array of args seq[i][2][0] = first arg The event based feature is a result of adding onslideend support to all the X animation functions (this is the only event supported for now). The current technique has an advantage in that it does not call eval - but this creates a disadvantage in that values in the action array are resolved when the array is initialized, not when the action is executed. The current technique has another disadvantage in that 'function.apply' requires JavaScript 1.3 (IE 5.5+).

Revisions

1: 31May05initial release

License

By your use of X and/or CBE and/or any Javascript from this site you consent to the GNU LGPL - please read it. If you have any questions about the license, read the FAQ and/or come to the forums.

Tech Support

Forum support is available at the X Library Support Forums.

About Cross-Browser.com

Cross-Browser.com is the home of X - a cross-browser Javascript library, and many demos, applications, articles and documentation.

Search

Cross-Browser.com

World Wide Web

User Projects

If you are using X, XC or anything from this site, show off your work by posting a link in the X Showcase forum.