Skip to content

Instantly share code, notes, and snippets.

@cbourdage
Created June 18, 2014 17:03
Show Gist options
  • Select an option

  • Save cbourdage/bcb2f092b63af52c8aa8 to your computer and use it in GitHub Desktop.

Select an option

Save cbourdage/bcb2f092b63af52c8aa8 to your computer and use it in GitHub Desktop.
Scroll UX and Custom Elements/Selects For Checkout
Accordion.prototype.openSection = function(section) {
var section = $(section);
// Check allow
if (this.checkAllow && !Element.hasClassName(section, 'allow')){
return;
}
if(section.id != this.currentSection) {
this.closeExistingSection();
this.currentSection = section.id;
$(this.currentSection).addClassName('active');
var contents = Element.select(section, '.a-item');
contents[0].show();
//Effect.SlideDown(contents[0], {duration:.2});
if (this.disallowAccessToNextSections) {
var pastCurrentSection = false;
for (var i=0; i<this.sections.length; i++) {
if (pastCurrentSection) {
Element.removeClassName(this.sections[i], 'allow')
}
if (this.sections[i].id==section.id) {
pastCurrentSection = true;
}
}
}
// Gorilla add for custom selects - init for billing step
jQuery(function() {
var $section = jQuery('#' + section.id);
$section.find('select').customSelect('reset', {calculateWidth : false});
$section.find('input[type=checkbox]').customFormElements();
$section.find('input[type=radio]').customFormElements();
var top = $section.offset().top;
jQuery('html, body').animate({scrollTop : top}, 500);
});
// End addition
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment