Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function presetAddtoCartButtons(){
- var orderRows = jQuery(".order-row .row");
- var shoppingIndicator = $(".header-order .fa-shopping-cart");
- var bodyNode = jQuery("body");
- var addToCartAnim = function(orderRow){
- var orderRowBox = jQuery("<div class='order-row-box' style='position:absolute; background:#D43F3A; width:40px; height:50px; z-index:9999; opacity:0; border-radius:10px;'></div>");
- orderRowBox.css("left", orderRow.offset().left);
- orderRowBox.css("top", orderRow.offset().top);
- orderRowBox.css("width", orderRow.width());
- orderRowBox.css("height", orderRow.height());
- bodyNode.append(orderRowBox);
- orderRowBox.animate({
- opacity:0.5
- }, {
- duration:200
- });
- orderRowBox.animate({
- left: shoppingIndicator.offset().left,
- top: shoppingIndicator.offset().top,
- width:20,
- height:20
- }, {
- duration:500,
- complete: function() {
- orderRowBox.remove();
- },
- queue: false,
- progress: function( now, fx, wtf ){
- if(fx < 0.5){
- orderRowBox.css("opacity", fx * 0.6);
- } else {
- orderRowBox.css("opacity", (1 - fx * 0.6));
- }
- }
- });
- };
- orderRows.each(function(){
- var orderRow = $(this);
- var btns = jQuery(".select-photo-custom", orderRow);
- btns.each(function(){
- var btn = $(this);
- btn.on("click", function(){addToCartAnim(orderRow);});
- });
- });
- }
- presetAddtoCartButtons();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement