Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function processTermsConditionsPopup(){
- $.colorbox({
- inline: true,
- href: '#terms-and-conditions',
- width: "640",
- height: "70%",
- onCleanup:function(e){
- $('#terms-and-conditions').hide();
- },
- onComplete: function(){
- var termsConditions = $("#terms-and-conditions"),
- termsConditionsJSP = termsConditions.find('.scroll-pane'),
- acceptButton = termsConditions.find('#acceptBtn'),
- // hack for IE8
- delayValue = $.browser.msie && parseInt($.browser.version, 10) == 8 ? 500 : 0;
- termsConditionsJSP.delay(delayValue).jScrollPane();
- console.log('complete', termsConditions, termsConditionsJSP, acceptButton);
- var scrollWrapperHeight = termsConditionsJSP.find('.jspContainer').height(),
- scrollContentHeight = termsConditionsJSP.find('.jspPane').height();
- // if terms & conditions text too short for scrolling, enable button immediately
- if (scrollWrapperHeight > scrollContentHeight) {
- acceptButton.removeAttr('disabled');
- }
- // else enable submit button after user scrolls all terms & conditions
- else {
- termsConditionsJSP.on('jsp-scroll-y', function(event, scrollPositionY, isAtTop, isAtBottom){
- if (isAtBottom == true) acceptButton.removeAttr('disabled');
- });
- }
- }
- });
- };
- function showTermAndConditions(url, productCode){
- $.ajax({
- url: url,
- type: 'get',
- beforeSend: function() {
- $('#terms-and-conditions').empty();
- $('#terms-and-conditions').show();
- },
- success: function(data) {
- $('#terms-and-conditions').append(data);
- $('#terms-and-conditions .scroll-pane').jScrollPane();
- processTermsConditionsPopup();
- }
- });
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement