Comments (3)
Hello Basti,
first of all thanks for you work and nice dev-theme! I really appreceate your work and am currently doing my first project on bootscore-basis. I have on suggestion for the offcanvas cart loader. The add to cart ajax requests on my server are quite fast (<100ms) and therefore it is quite weird to have a 1s delay on the loader transition.
#offcanvas-cart.show .cart-loader {
transition-delay: 1s;
}I understand, that that delay should prevent any content flashing but wouldn't it be possible to just add another class to the loader (.loaded) after the ajax request returns and remove the delay completely? That should then work all the time and no content should be flashing.
I hope this is the right place for such suggestions. If not then just point me there please :)
I did a little research on an solution to that issue. Here is my suggestion:
I changed
#offcanvas-cart.show .cart-loader {
opacity: 0;
transition: opacity .3s, visibility .3s;
transition-delay: 1s;
visibility: hidden;
}
to
#offcanvas-cart.show.loaded .cart-loader {
opacity: 0;
transition: opacity .1s, visibility .1s;
transition-delay: 0s;
visibility: hidden;
}and added
$('body').bind('added_to_cart' , function(){
$('#offcanvas-cart').addClass('loaded');
});$('body').bind('hidden.bs.offcanvas' , function(){
$('#offcanvas-cart').removeClass('loaded');
});to woocommerce.js
Changed my approach a little bit to prevent issues on cart opens without adding and speed them up as well:
added
$(document.body).trigger('cart-loading',[]);
right after
$('form.cart').on('submit', function(e) {
e.preventDefault();
and changed the css therefore to:
#offcanvas-cart.show .cart-loader {
opacity: 0;
visibility: hidden;
transition: opacity .1s, visibility .1s;
}
#offcanvas-cart.show.loading .cart-loader {
transition-delay: 0s;
opacity: 1;
transition: opacity .1s, visibility .1s;
visibility: visible;
}
and the js to:
$('body').bind('cart-loading' , function(){
$('#offcanvas-cart').addClass('loading');
console.log("triggered");
});
$('body').bind('added_to_cart' , function(){
$('#offcanvas-cart').removeClass('loading');
});
from bootscore.
Hello @Axos11 ,
thank you very much! I will check that next week and implement it in the theme.
Can you send me your both files woocommerce.js and woocommerce-style.css via mail to store(at)bootscore.me? So, it will be much faster for me to check.
Thank you again. The loader was something which I was struggeling a long time.
from bootscore.
Hello @Axos11 ,
implemented your code in the theme. I changed a bit of CSS. Now loader is not a fake-loader anymore. Loader only appears if a product is added to the cart. This is a huge improvement, thank you very much for your contribute.
I close this issue now.
Best regards
Basti
from bootscore.
Related Issues (20)
- Remove sidebar single-product
- [Feature Request] Quantity Swatches for sidebar cart (no reload) HOT 1
- Get wp_title() in header.php HOT 5
- Rewrite main.scss
- Matomo Wordpress-Plugin
- Woocommerce add to cart restrictions
- [Feature Request] Remove limitation wpsites_query HOT 3
- [BUG] Not able to scroll page using Divi page editor on Tab and Mobile view HOT 7
- Overwrite SCSS variables
- [BUG] Woocommerce Products Shortcode HOT 3
- Unable to style an active navbar item
- Unable to close a photo from the media gallery when enlarged or go back HOT 9
- Create assets folder HOT 4
- [BUG] Potential Woocommerce Bug in the Slide out Basket HOT 2
- [BUG/Help Wanted] Pagination for Post HOT 3
- [BUG] Double eye in account offcanvas HOT 1
- Reason of using fixed-top HOT 1
- <header><footer> inside <main>
- [BUG] Dark Mode Plugin HOT 3
- [BUG] Edit single product page
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from bootscore.