Finkin Fridom

Una mente creativa lavora meglio di notte

jMobile - Documentation

Download the latest version

jMobile available methods:

  • log( [arguments] )
    It is a wrapper method to allow console.log usage
  • logBag
    It is an object to collect every jMobile.log usage.
    The result object is made of:
    • msg: an array property.
      It contains all the string values passed to jMobile.log
    • objs: an object-list property
      It contains all the objects parameters passed to jMobile.log
    • add: a method to populate either 'msg' property or 'objs' property.
  • addListener( o, type, listener, useCapture )
    It is a wrapper method for 'addEventListener' / 'attachEvent' methods.
    • o: The object on which add the event listener
    • type: The event name
    • listener: The callback method to execute on event-fire
    • useCapture: Required parameter for addEventListener DOM native method. (default = false)
  • removeListener( o, type, listener )
    It is a wrapper method for 'removeEventListener' / 'detachEvent' methods.
    • o: The object on which remove the event listener
    • type: The event name
    • listener: The callback method to remove from this event
  • getStyle( elm )
    It is a short-hand method to retrieve 'elm' CSS-declared style.
  • between (objA, objB, propName, radix)
    If 'propName' exists into objA then return this 'propName' value, otherwise it will return the value of objB 'propName'.
    If 'radix' parameter is specified then the output result will be parsed as a number (if radix is float the result will be float, otherwise int).
  • debug
    If 'debugger' keywords is supported then it will executed.
  • getInnerHeight
    Returns window/document/screen or body inner height.
  • getOuterHeight
    Returns window/document/screen or body outer height.
  • getInnerWidth
    Returns window/document/screen or body inner width.
  • getOuterWidth
    It will return window/document/screen or body outer width.
  • getScrollMaxY
    Returns the remaining available scrollable document portion.
  • setDimensions
    It set innerHeight, outerHeight, innerWidth and outerWidth properties.
  • each ( o, callback )
    Executes the specified 'callback' method passing the specified object 'o' as context.
  • extend ( [arguments] )
    Returns an object with arguments specified properties and methods.
  • ajax ( cfg )
    Exec an async HTTP request.
  • get ( url, [data, [success]] )
    Short-hand method for jMobile.ajax.

jMobile-element available methods:

  • jMobile( [selector or object], context )
    Returns a jMobile-element.
  • get( idx )
    Returns the DOM-element specified by 'idx' parameter.
  • hide
    It hides all the jMobile-element.
    Returns the jMobile-element.
  • hide_single( i )
    It hides the DOM-element specified by the 'i' parameter.
  • show
    It shows all the jMobile-element.
    Returns the jMobile-element.
  • show_single( i )
    It shows the DOM-element specified by the 'i' parameter.
  • toggle
    It toggles all the jMobile-element visibility.
    Returns the jMobile-element.
  • toggle_single( i )
    It toggles the DOM-element (specified by the 'i' parameter) visibility.
  • css( prop, [value] )
    If 'prop' is a string, it will set the specified CSS-property to the specified 'value'.
    If 'prop' is an object it will set all the specified CSS-properties to the corresponding values.
    Returns the jMobile-element.
  • hasClass( className )
    It will search if the jMobile-element contains the specified 'className'.
    It returns a boolean.
  • toggleClass( className )
    If the jMobile-element has the specified 'className' it will remove it, otherwise it will add it.
    Returns jMobile-element.
  • addClass className )
    It will add the specified 'className' to the jMobile-element (only if the specified 'className' doesn't already exists).
    Returns jMobile-element.
  • removeClass( className )
    If present, it will remove the specified 'className' from jMobile-element.
    Returns jMobile-element.
  • filter( selectorOrCallback )
    It will filter the jMobile-element by the specified 'selectorOrCallback' parameter.
    Returns the filtered jMobile-element.
  • each( callback )
    Apply the specified 'callback' parameter to every jMobile-element in the collection.
    Returns jMobile-element.
  • add( j )
    Add the specified 'j' jMobile-element to the actual jMobile-elements collection.
    Returns the new jMobile-elements collection.
  • remove( [selector] )
    Remove the actual jMobile-element.
    If 'selector' parameter is specified, it will remove only the jMobile-element specified by the 'selector' parameter.
    Returns the new jMobile-elements collection.
  • closest( selector )
    It will traverse the DOM up until the specified 'selector' parameter element is found.
    Returns jMobile-element.
  • is( selectorOrCallback )
    It will check if the jMobile-elements collection is as the 'selectorOrCallback' specified parameter.
    Returns a boolean.
  • find( selector )
    It search inside the jMobile-elements collection the corresponding element to the 'selector' parameter.
    Returns jMobile-element.
  • end
    It change the jMobile-elements collection to the parent context.
    Returns jMobile-element.
  • index( [lookFor] )
    It will return the jMobile-element index inside the parent element.
    If 'lookFor' parameter is specified, it will return the 'lookFor' index inside jMobile-elements collection.
    Returns an integer.
  • first
    Returns the first jMobile-element of the collection.
  • last
    Returns the last jMobile-element of the collection.
  • eq( idx )
    Returns the jMobile-element specified by the 'idx' parameter.
  • next
    Returns the jMobile-elements collection next sibling.
  • prev
    Returns the jMobile-elements collection previous sibling.
  • parent
    Returns the jMobile-elements collection parent node.
  • attr( name, [value] )
    If 'name' parameter only is specified, it will return the specified attribute value.
    If 'value' parameter is also specified, it will set the specified attribute to 'value' and returns the jMobile-elements collection.
  • attr_single( i, name, [value] )
    Same as 'attr' method but performed on jMobile-element specified by 'i' parameter.
  • not( selector )
    Returns the jMobile-elements collection except the ones matching the specified 'selector' parameter.
  • searchCssClass( pattern, config )
    It search inside the first DOM-element class attribute for the specified 'pattern' and 'config'.
    'config' parameter is an object to determine how to split the found class selector and which index (related to the split) to return:
    • splitChar (default: '-')
    • index (default: 1)
    • rawVal (default: false)
  • text( [value] )
    If 'value' is specified it will be set as the text of the jMobile-elements collection and return the jMobile-elements collection.
    Otherwise it returns the text value of the first jMobile-element.
  • ready
    jMobile(document) entry-point for 'DOMContentLoaded'/'load' events.
  • bind( eventName, callback )
    It binds the specified 'callback' to the specified 'eventName' for the jMobile-elements collection.
  • exists()
    It checks if the jMobile-elements exists.
    Returns a boolean.
  • outerWidth( [includeMargin] )
    Returns the outerWidth for the first jMobile-element in the collection.
    If 'includeMargin' is true, then 'margin' values are also included.
    Returns a number.
  • append ( value )
    Append the specified string/DOM element to the current jMobile object.
  • prepend ( value )
    Prepend the specified string/DOM element to the current jMobile object.