Using Events

You can use a wide range of events to add custom code. Available events:

  • Locked - fires when content is locked.
  • Unlocked - fires when content is unlocked.
  • Canceled - fires when locking of content is canceled.

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 }
});
OnePress (c) 2016. Learn more about Social Locker for jQuery.