You can use a wide range of events to add custom code. Available events:
Live Example:
Code:
// IMPORTANT: put handlers for events before creating the locker
// - locked
$.pandalocker.hooks.add( 'opanda-lock', function(e, locker, sender){
alert('The content was locked!');
});
// - unlocked
$.pandalocker.hooks.add( 'opanda-unlock', function(e, locker, sender){
alert('The content was unlocked via: ' + sender + "!");
});
// - canceled
// happens when the user already unlocked content and visits your page again
$.pandalocker.hooks.add( 'opanda-cancel', function(e, locker, sender){
alert('Locking of content was canceled!');
});
$(".to-lock").sociallocker({
locker: { timer: 30, close: true }
});