Dynamic List

Developer
Size
2,413 Kb
Views
30,360

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 Previews

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);	});
Dynamic List - Script Codes
Dynamic List - Script Codes
Home Page Home
Developer Robert Biggs
Username rbiggs
Uploaded August 24, 2022
Rating 4
Size 2,413 Kb
Views 30,360
Do you need developer help for Dynamic 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!

Robert Biggs (rbiggs) Script Codes
Create amazing video scripts 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!