Using Events

You can use a wide range of events to add costume code. Available aventes are listed as under:


  • Locked - Fires when content is locked
  • Unlocked - Fires when content is unlocked
  • Canceled - Fires when locking of content is cancled


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 }
});

Post a Comment

Was this article useful? Please Leave Your Feedback by writing what's in your mind, below.

Recent Comments

{getWidget} $results={3} $label={comments} $type={list}