jlscroller.js

Extends the <jLogger> class to capture scroll events.

Dependancies

mootoolsMoo.js, Utility.js, String.js, Array.js, Function.js, Element.js, Dom.js
cnet librariesdbug.js, jlogger.js

Author

Aaron Newton, <aaron [dot] newton [at] cnet [dot] com>

Summary
jlscroller.jsExtends the <jLogger> class to capture scroll events.
JlScrollerAdds Scroll captures to the jlogger class; extends <jlogger>.
Change Log$Source: /cvs/main/flatfile/html/rb/js/global/cnet.global.framework/common/utilities/jlscroller.js,v $ $Log: jlscroller.js,v $ Revision 1.6 2007/03/28 18:09:03 newtona removing $type.isNumber dependencies

JlScroller

Adds Scroll captures to the jlogger class; extends <jlogger>.

Arguments

optionsoptional, an object containing options.

Options

scrollTo{top: #|element, bottom: #|element}
  • top: a number for the top range to observe (i.e. if the user scrolls down that many pixels) or an element, whose top will set the top range of the scroll area to observe
bottom: (optional)if left empty, the range will be zero (i.e. top = bottom)
  • a number for the bottom range to observe
  • or the same element as the top element which will create a range the height of that element,
  • or, no value for top but an element id for the bottom will set the bottom of the element to a single line across the page,
  • or a different element, the top of which will define the bottom range of the area Note: a scrollTo observer requires no entry for the ‘element’ variable to instantiate it. additionally, either the top or the bottom range must be visible (i.e. any portion of the range) for the ping to fire

Example

//capture a scroll to 800 pixels
new jlogger({
ontid: '20',
siteId:'4',
pId:'2001',
tag:'scrollTo800',
fireOnce: false,
event: 'scrollTo',
scrollTo: {top:'800'}
});

//capture scroll to the top of an element
new jlogger({
ontid: '20',
siteId:'4',
pId:'2001',
tag:'scrollBoxTop',
fireOnce: false,
event: 'scrollTo',
scrollTo: {top:'myElement'}
});

Change Log

$Source: /cvs/main/flatfile/html/rb/js/global/cnet.global.framework/common/utilities/jlscroller.js,v $ $Log: jlscroller.js,v $ Revision 1.6 2007/03/28 18:09:03 newtona removing $type.isNumber dependencies

Revision 1.5 2007/03/10 00:31:10 newtona .pingDW is now just .ping element and event are no longer required (so jloggers can just get fired inline) executeNow is deprecated; just use new Jlogger().ping() added support for cval and ctype

Revision 1.4 2007/03/09 20:15:03 newtona numerous bug fixes

Revision 1.3 2007/01/26 05:56:03 newtona syntax update for mootools 1.0 docs update

Revision 1.2 2007/01/22 21:54:17 newtona updated for mootools version 1.0 updated namespaces to capitazlied values

Revision 1.1 2007/01/09 02:39:35 newtona renamed addons directory to “common” directory

Revision 1.2 2006/11/04 00:52:21 newtona added docs, fixed a little syntax

Revision 1.1 2006/11/03 19:41:25 newtona moving jlscroller class into it’s own javasacript file

My Object Oriented javascript.
Contains Utility functions
Contains String prototypes and Number prototypes.
function $A(array,
start,
length)
returns a copy of the array.
Same as Array.copy, but as function.
function $each(iterable,
fn,
bind)
Use to iterate through iterables that are not regular arrays, such as builtin getElementsByTagName calls, arguments of a function, or an object.
Contains Array prototypes, $A, $each
Contains Function prototypes and utility functions .
function $(el)
returns the element passed in with all the Element prototypes applied.
Contains useful Element prototypes, to be used with the dollar function $.
This extends the Element prototype.
Css Query related function and Element extensions
Wrapper for the firebug console.log() function.
Collected functions and objects for the CNET “Redball” family of sites.