Breadcrumb

Introduction

Universal Theme provides the following JavaScript APIs that you may find useful in your applications.

API List

  1. apex.theme42.configureSuccessMessages( pOptions )

    Configure the display behavior of success messages. You can use this API to programmatically determine how long the success message is displayed before automatically dismissing itself.

    apex.jQuery(function() { apex.theme42.configureSuccessMessages({ autoDismiss: true, duration: 5000 // duration is optional (Default is 3000 milliseconds) }); });
  2. apex.theme42.util.scrollTo( pId )

    Enables smooth scrolling to the specified anchor, taking into account the sticky top height so the content is not partially blocked.

    // Example 1: Simply call it to scroll to an region apex.theme42.util.scrollTo( 'my_region' ); // Example 2: Use smooth scroll for all anchor links such as href="#my_content". apex.jQuery(function() { $( "a[href^='#']" ).click(function( e ) { e.preventDefault(); apex.theme42.util.scrollTo( apex.jQuery( this ).attr( 'href' ) ); }); });
  3. apex.theme42.util.mq( pMediaQueryString )

    Returns boolean for the media query. This is a wrapper of window.matchMedia.matches.

    apex.jQuery( window ).on('apexwindowresized', function() { if ( apex.theme42.util.mq( '(min-width: 640px)' ) ) { console.log( 'Window resized, and viewport is at least 640px wide' ) } });