Reputation: 9977
I have a page that loads videos via .load(). I want to add loading text that disappears once the page is loaded. Please can someone tell me how to accomplish this, I have no idea how to tell if the page is finished loading, so I don't know when to remove the loader.
JS
// define var video
var video = $('div.video');
// define click function
$('a').on('click', function( e ) {
// define var link
var link = $(this).attr('href');
// Add loading text
$('.wrap').append('<span class="load">Loading text...</span>');
// load content into video
video.load( link + ' .content' );
// prevent default href action
e.preventDefault();
});
Thanks for the help. Cheers
Upvotes: 0
Views: 160
Reputation: 490453
This ought to do it.
video.load( link + ' .content' , function() {
$('.wrap .load').remove();
});
Upvotes: 1