Skip to Main Content

Introduction

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

API List

  1. apex.theme42.util.configAPEXMsgs( 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.util.configAPEXMsgs({
        autoDismiss: true,
        duration: 5000  // duration is optional (Default is 3000 milliseconds)
      });
    });

    Note: The previous name for this API, apex.theme42.configureSuccessMessages, is deprecated and will be removed in a future release. Please update your application to use the new name.

  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' ) );
      });
    });