Simple jq toggle example

Example to demonstrate basic toggle functionality.

HTML

<div id="target">Toggle this</div>

JavaScript

$('#target').toggle(function() {
    var divWidth=$(".pt-page-2").width() / 100 * 50;
  $('#exampleDiv').animate({'marginLeft': divWidth + "px"}, 2000);
}, function() {
    var divWidth=$(".pt-page-2").width() / 100 * 50;
  $('#exampleDiv').animate({'marginRight': divWidth + "px"}, 2000);
});