Advertisement
Guest User

Untitled

a guest
Oct 22nd, 2014
124
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function processTermsConditionsPopup(){
  2.     $.colorbox({
  3.         inline: true,
  4.         href: '#terms-and-conditions',
  5.         width: "640",
  6.         height: "70%",
  7.         onCleanup:function(e){
  8.             $('#terms-and-conditions').hide();
  9.         },
  10.         onComplete: function(){
  11.             var termsConditions = $("#terms-and-conditions"),
  12.                 termsConditionsJSP = termsConditions.find('.scroll-pane'),
  13.                 acceptButton = termsConditions.find('#acceptBtn'),
  14.                 // hack for IE8
  15.                 delayValue = $.browser.msie && parseInt($.browser.version, 10) == 8 ? 500 : 0;
  16.  
  17.             termsConditionsJSP.delay(delayValue).jScrollPane();
  18.  
  19.             console.log('complete', termsConditions, termsConditionsJSP, acceptButton);
  20.  
  21.             var scrollWrapperHeight = termsConditionsJSP.find('.jspContainer').height(),
  22.                 scrollContentHeight = termsConditionsJSP.find('.jspPane').height();
  23.            
  24.             // if terms & conditions text too short for scrolling, enable button immediately
  25.             if (scrollWrapperHeight > scrollContentHeight) {
  26.                 acceptButton.removeAttr('disabled');
  27.             }
  28.             // else enable submit button after user scrolls all terms & conditions
  29.             else {
  30.                 termsConditionsJSP.on('jsp-scroll-y', function(event, scrollPositionY, isAtTop, isAtBottom){
  31.                     if (isAtBottom == true) acceptButton.removeAttr('disabled');
  32.                 });
  33.             }
  34.         }
  35.     });
  36. };
  37.  
  38. function showTermAndConditions(url, productCode){
  39.     $.ajax({
  40.         url: url,
  41.         type: 'get',
  42.         beforeSend: function() {
  43.             $('#terms-and-conditions').empty();
  44.             $('#terms-and-conditions').show();
  45.         },
  46.         success: function(data) {                  
  47.             $('#terms-and-conditions').append(data);
  48.             $('#terms-and-conditions .scroll-pane').jScrollPane();
  49.             processTermsConditionsPopup();
  50.         }
  51.     });
  52. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement