Last active
August 29, 2015 14:26
-
-
Save scottopolis/3b9a72103e0835af990e to your computer and use it in GitHub Desktop.
Add ajax links to AppTheme
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Add custom ajax powered links to your AppPresser app. Add this to a javascript file, enqueued in a child of AppTheme | |
var AppCustom = {}; | |
AppCustom.init = function() { | |
$ = jQuery; | |
$('body').on('click', 'a.test-link, #another-link a', function(event) { | |
if ( window.apppresser.canAjax( $(this) ) ) { | |
window.apppresser.loadAjaxContent( $(this).attr('href'), false, event ); | |
} | |
}); | |
} | |
// load script on doc ready and ajax content load. Don't put everything in a .ready function, it won't load properly. | |
jQuery(document).ready( AppCustom.init ).on( 'load_ajax_content_done', AppCustom.init ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment