Tuesday, March 3, 2015

Getting Books to Load! (3/3)

Today we made a lot of progress! In addition to search bugfixes, we also finally got the variable to pass between pages. It's done via an onClick event.

Basically, when the user clicks on an individual search result, we save the variable of that book to localStorage. Then, I figured out an onPageLoad event via JavaScript. It looks like the following:

$( document ).on( "pagecreate", "#homeSettings", function( event ) {
  console.log("Settings.html loaded");
});

Where #homeSettings is the name of the div that has the data-role of page in the html file.

We then have a method such that when book.html is loaded, it loads the ID, and can therefore then get JSON and other information about the book. From there, it should be extremely easy to load the audiobook, and the user can later go back and choose a new one!

I also setup some basic sliders for the book time, as well as play, pause, volume, and stop buttons. I'll add functionality to them hopefully tomorrow.

1 comment:

  1. Nice post! You are making progress in several areas that will continue to benefit this project (and you professionally) going forward:

    1. You are writing clearer descriptions of what you are doing.
    2. You are learning the required technical vocabulary needed to do 1.
    3. You are providing valuable links to the specific code you are describing.

    As I've said to you before, one of the big benefits I'm planning on deriving from both your work here and your Summer internship is to be able to leverage your documentation of your learning to both shorten the time I'll need to learn FXOS development myself next Summer, and to provide resources for curriculum materials I'll then develop to teach students in the future.

    The better you document, the more easily I'll be able to achieve both aims. Keep up the good work!
    2.

    ReplyDelete