Functions

Helpful functions for interacting with DOM elements.

Get Query String

Get the query string from the URL.

.getQueryString(replaceSpaces);

  • replaceSpaces boolean
    Replace %20 and + with a space.

Returns object

  • var_1 string
    Value of variable
  • var_2 string
    Value of variable
  • etc
// URL = file.html?message=hello+world

// Get query string
var QS=$STAN.getQueryString(true);

// Output the message variable (hello world)
console.log(QS.message);

Get Size

Get the width/height of an element even if it is currently hidden.

.getSize(element[,css]);

  • element string
    A jQuery selector to match elements
  • css object
    CSS properties to apply to the element before getting its size

Returns object

  • width integer
    Width of element
  • height integer
    Height of element
  • outerWidth integer
    Outer width of element
  • outerHeight integer
    Outer height of element
  • outerWidthMargin integer
    Outer width of element including margin
  • outerHeightMargin integer
    Outer height of element including margin
// Get size
var Size=$STAN.getSize('.foo');

// Set the outerWidth value from Size object
var outerWidth=Size.outerWidth;

Over Out Delay

Add mouse over and mouse out events to an element - but with the option to delay the mouse out event.

.overOutDelay(element,over,out,delay);

  • element string
    A jQuery selector to match elements
  • over function
    Code to run on mouse over event
  • out function
    Code to run on mouse out event
  • delay integer
    Delay in micro seconds to execute out function
$STAN.overOutDelay('.foo',function(){
  // code to execute on over
},function(){
  // code to execute on out
},2000);

STAN v0.0.40   -   Download   -   View Github Project