Skip to:
Content
Pages
Categories
Search
Top
Bottom

BP Ajax and Javascript?

  • Is there a way you can load js with BP ajax loaded items? JavaScript of course only loads once, but is there a way you can make it fire on content loaded via BP ajax?

Viewing 3 replies - 1 through 3 (of 3 total)

  • Tammie Lister
    Moderator

    @karmatosed

    I ‘may’ not have the right end of the stick with what you are looking to do but this:

    `wp_enqueue_script( ‘dtheme-ajax-js’, get_template_directory_uri() . ‘/_inc/global.js’, array( ‘jquery’ ), bp_get_version() );
    `

    You can hook into that ‘array’ if you want to.

    https://codex.wordpress.org/Function_Reference/wp_enqueue_script

    $deps
    (array) (optional) Array of handles of any script that this script depends on (scripts that must be loaded before this script). false if there are no dependencies. This parameter is only required when WordPress does not already know about this script.
    Default: array()


    Roger Coathup
    Participant

    @rogercoathup

    @FIQ – assume you are meaning a jQuery event, equivalent to something like a document.ready() that fires on Ajax load. Pretty sure there are some default jQuery events ready to AJAX activity.. can’t remember names off top of my head

    [EDIT: take a look at the global jQuery ajaxSuccess, ajaxError, ajaxStart, ajaxSend, and ajaxStop events — there are also local versions]

    I’m completely ignorant about ajax and only slightly better with js. Most things I can figure out by trial and error, but not with ajax.

    Two of the problems I’m have is with Fitvids.js (responsive video embeds) and prettyPhoto.js (lightbox).

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘BP Ajax and Javascript?’ is closed to new replies.
Skip to toolbar