Skip to content

FlyToCart is a jquery plugin that enables send a image to the shopping cart

Notifications You must be signed in to change notification settings

sangar82/FlyToCart

Repository files navigation

FlyToCart jQuery Plugin v1.0.0
-------------------------------
Copyright (c) 2011 Iván Sánchez. Licensed under the MIT license.
 

Overview
--------

FlyToCart is a jquery plugin that enables send a image to the shopping cart


Features include:

- Send a image at any class or id
- Callback function
- Override options (id or class destination and movement velocity)


Usage
-----

You must have an element (div, p, span, etc. with class='destination'  where the image will be sent. You can change the name of this class, see case 3. 

<script>
  $(".flying").flytoCart();
</script>

<div class='destination'></div>

<div id='products'>
  <a href='#' class='flying' ><img  src='img/amarillo.jpg'  width='100'  id='product_id_1' /></a>
  <a href='#' class='flying' ><img  src='img/negro.jpg'     width='100'  id='product_id_2' /></a>
  <a href='#' class='flying' ><img  src='img/verde.jpg'     width='100'  id='product_id_3'  /></a>
</div>


// CASE 1: create the flyToCart instance 
$(".flying").flytoCart();

// CASE 2: Create the instance and callback
$(".flying").flytoCart( function(){
	//do something to add the product to the shopping cart
  	alert(this.id + " add to the shopping cart");
} );

// CASE 3: Create the instance, callback and override options (change the velocity and the destination)
$(".flying").flytoCart( function(){
	  alert("Finish with "+this.id);
	  }, {velocity:10000, destination: '.shoppingcart'} 
);

About

FlyToCart is a jquery plugin that enables send a image to the shopping cart

Resources

Stars

Watchers

Forks

Packages

No packages published