Dynamic List
How do I make an dynamic list?
A navigation list with dynamic content through Ajax and templates. This is the iOS 7 theme using the ChocolateChip-UI framework.. What is a dynamic list? How do you make a dynamic list? This script and codes were developed by Robert Biggs on 24 August 2022, Wednesday.
Dynamic List - Script Codes HTML Codes
<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>Dynamic List</title> <meta name="viewport" content="initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="mobile-web-app-capable" content="yes">
<meta name="msapplication-tap-highlight" content="no"> <link rel='stylesheet prefetch' href='https://s3-us-west-2.amazonaws.com/s.cdpn.io/77047/chui.ios-3.0.4.min.css'> <link rel="stylesheet" href="css/style.css">
</head>
<body> <nav class="current"> <h1>Recipes</h1> </nav> <article id="recipes" class="current"> <section> <ul class="list" id='recipesList'></ul> </section> </article> <nav class="next"> <a href="#" class="button back">Recipes</a> <h1 id='recipeTitle'>Recipe</h1> </nav> <article id="detail" class="next"> <section> <h2>Ingredients</h2> <ul class="list"><li><ul id='ingredients'></ul></li></ul> <h2>Directions</h2> <ul class="list"><li><ol id='directions'></ol></li></ul> </section> </article> <script src='http://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js'></script>
<script src='https://s3-us-west-2.amazonaws.com/s.cdpn.io/77047/chui-3.0.4.min.js'></script> <script src="js/index.js"></script>
</body>
</html>
Dynamic List - Script Codes CSS Codes
ul ul li,ul ol li { color: #666;
}
Dynamic List - Script Codes JS Codes
var list = '<li data-goto="detail" id="[[= data.id ]]" class="nav"><h3>[[= data.title ]]</h3></li>'; var tempList = $.template(list); var templ8 = '<li><h3>[[=data]]</h3></li>'; var tmpTempl8 = $.template(templ8); var recipesList = $('#recipesList'); var recipes; $.ajax({ url : 'https://s3-us-west-2.amazonaws.com/s.cdpn.io/77047/recipes.js', type: 'GET', success: function(data) { recipes = JSON.parse(data); recipes.forEach(function(ctx, idx) { //console.dir(ctx) recipesList.append(tempList(ctx)); }); } }); recipesList.on('singletap', 'li', function() { var recipeID = $(this).attr('id'); var recipe = recipes.filter(function(ctx) { return ctx.id === recipeID; }); $('#ingredients').empty(); recipe[0].ingredients.forEach(function(ctx) { $('#ingredients').append(tmpTempl8(ctx)) }) $("#directions").empty(); recipe[0].directions.forEach(function(ctx) { $('#directions').append(tmpTempl8(ctx)) }) $('#recipeTitle').html(recipe[0].title); });
Developer | Robert Biggs |
Username | rbiggs |
Uploaded | August 24, 2022 |
Rating | 4 |
Size | 2,413 Kb |
Views | 30,360 |
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!
Name | Size |
Slide out Menu | 4,936 Kb |
Slide out Menu | 5,172 Kb |
Tab Bar App | 7,112 Kb |
IOS 7 Switch | 2,235 Kb |
Simple List | 1,736 Kb |
TypeScript d.ts Test | 1,623 Kb |
Dynamic List | 2,257 Kb |
IOS 7 Transparent Sheet | 2,719 Kb |
Simple List | 1,675 Kb |
IOS 7 Selection List | 1,962 Kb |
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!
Name | Username | Size |
Jochaho Skeleton | Dhanushbadge | 1,689 Kb |
Two column of responsive height | Fixie | 2,908 Kb |
Prism | Pyrografix | 2,843 Kb |
Mandelbrot Fractal | _Billy_Brown | 2,706 Kb |
Voting App - register | MatheusLima92 | 1,948 Kb |
Flexbox Test | Icutpeople | 2,486 Kb |
Lazy Load for Background Images | The_ruther4d | 2,977 Kb |
Tail rose iris lined | Kbrtrm | 1,846 Kb |
Basic template | Tomcat | 1,675 Kb |
Form Labels | Bartuc | 2,717 Kb |
Surf anonymously, prevent hackers from acquiring your IP address, send anonymous email, and encrypt your Internet connection. High speed, ultra secure, and easy to use. Instant setup. Hide Your IP Now!