HTML and CSS Reference
In-Depth Information
var view = new app.view.movielist(_movies);
// Set the contents of the search results div
_favoriteslist.innerHTML = '';
// Append the view to the favorites list
// Destroy the listScroll if it exists
if(_listScroll !== null){
_listScroll = null;
// Create a new one
_listScroll = new iScroll(_favoriteslist);
// Hide all of the cards
// Show only the favorites card
Adding Favorites
With the movie list complete, you will now need an action to add favorites to the
list. This is a really simple action, as it will loop through the user's favorites from
localStorage to check whether it exists. If it doesn't, it will then proceed to add
the movie to the user's favorites and change the state of the button that called
it, so that the user can remove the movie from his favorites without having to
refresh the page.
var app = app || {};
app.controller = app.controller || {};
app.controller.favorites = function(){
this.add = function(data){
// Get the movie data
var _movie = data;
// Load the favorites from localStorage
var _favorites = JSON.parse(localStorage.favorites);
Search WWH ::

Custom Search