Skip to content
This repository has been archived by the owner on Aug 30, 2018. It is now read-only.

Scroll top when adding product. Classes for styling #142

Merged
merged 1 commit into from
Jul 8, 2014
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 7 additions & 0 deletions assets/ajaxify.js
Original file line number Diff line number Diff line change
Expand Up @@ -619,6 +619,9 @@ var ajaxifyShopify = (function(module, $) {
$formContainer.submit(function(e) {
e.preventDefault();

// Add class to be styled if desired
$addToCart.removeClass('is-added').addClass('is-adding');

// Remove any previous quantity errors
$('.qty-error').remove();

Expand All @@ -634,6 +637,8 @@ var ajaxifyShopify = (function(module, $) {
};

itemAddedCallback = function (product) {
$addToCart.removeClass('is-adding').addClass('is-added');

// Slight delay of flip to mimic a longer load
switch (settings.method) {
case 'flip':
Expand Down Expand Up @@ -675,6 +680,8 @@ var ajaxifyShopify = (function(module, $) {
buildCart(cart);
if ( !$drawerContainer.hasClass('is-visible') ) {
showDrawer();
} else {
scrollTop();
}
break;
}
Expand Down