Skip to content

tildah/item-selector

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 

Repository files navigation

item-selector

web component for selecting products and adding them to cart

Possible attributes:

  • id
  • item-id
  • item-link
  • height
  • width
  • img-src
  • router-type

Custom events:

  • select-item
  • deselect-item

Installation

npm i item-selector

Usage

<!Doctype html>
<html>
    <head>
        <title>title</title>
    </head>
    <body>
        <item-selector selected="true" height="225px" width="200px" img-src="./img/item.png">
    </body>
    <script>
        document.querySelector("item-selector")
		.addEventListener("select-item", add);
		
        document.querySelector("item-selector"
		).addEventListener("deselect-item", remove);

        function add() {console.log("product is selected")}    
	function remove() { console.log("product is unselected")}

	</script>
</html>``

About

web component for selecting items

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published