Basic jQuery Filter list

Developer
Size
2,464 Kb
Views
30,360

How do I make an basic jquery filter list?

Basic filtering of a list using data-attributed. What is a basic jquery filter list? How do you make a basic jquery filter list? This script and codes were developed by Matt Edwards on 12 August 2022, Friday.

Basic jQuery Filter list Previews

Basic jQuery Filter list - Script Codes HTML Codes

<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>Basic jQuery Filter list</title> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/normalize/5.0.0/normalize.min.css"> <link rel="stylesheet" href="css/style.css">
</head>
<body> <div class="wrap">
<ul class="boxes"> <div class="titles"> <h1>jQuery Filter Test</h1> <ul class="filters"> <li> <a href="#" data-filter="all">All</a> </li> <li> <a href="#" data-filter="green">Green</a> </li> <li> <a href="#" data-filter="blue">Blue</a> </li> <li> <a href="#" data-filter="red">Red</a> </li> </ul> </div> <li class="green" data-color="green"></li> <li class="blue" data-color="blue"></li> <li class="red" data-color="red"></li> <li class="green" data-color="green"></li> <li class="blue" data-color="blue"></li> <li class="red" data-color="red"></li> <li class="blue" data-color="blue"></li> <li class="green" data-color="green"></li> <li class="blue" data-color="blue"></li> <li class="red" data-color="red"></li> <li class="green" data-color="green"></li> <li class="green" data-color="green"></li> <li class="green" data-color="green"></li> <li class="blue" data-color="blue"></li> <li class="blue" data-color="blue"></li> <li class="red" data-color="red"></li>
</ul>
</div> <script src='http://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js'></script> <script src="js/index.js"></script>
</body>
</html>

Basic jQuery Filter list - Script Codes CSS Codes

body { margin: 50px;
}
.wrap { width: 820px;
}
.titles { width: 462px; height: 306px; background: #bada55; display: inline-block; float: left; margin: 3px;
}
ul.filters li { float: left; display: inline-block; margin-right: 10px; height: auto; width: auto;
}
.boxes li { width: 150px; height: 150px; float: left; margin: 3px; list-style: none; transition: all 2s;
}
.boxes li.green { background: green;
}
.boxes li.blue { background: blue;
}
.boxes li.red { background: tomato;
}

Basic jQuery Filter list - Script Codes JS Codes

$('.filters a').click(function(){ var boxes = $('ul.boxes li'); var filter = $(this).data("filter"); boxes.hide(); if( filter == "all") { boxes.show('slow'); } else { filter = '.'+filter; boxes.filter(filter).show('slow'); } return false;
});
Basic jQuery Filter list - Script Codes
Basic jQuery Filter list - Script Codes
Home Page Home
Developer Matt Edwards
Username mtedwards
Uploaded August 12, 2022
Rating 3
Size 2,464 Kb
Views 30,360
Do you need developer help for Basic jQuery Filter list?

Find the perfect freelance services for your business! Fiverr's mission is to change how the world works together. Fiverr connects businesses with freelancers offering digital services in 500+ categories. Find Developer!

Matt Edwards (mtedwards) Script Codes
Create amazing captions with AI!

Jasper is the AI Content Generator that helps you and your team break through creative blocks to create amazing, original content 10X faster. Discover all the ways the Jasper AI Content Platform can help streamline your creative workflows. Start For Free!