Book Image

Web Design Blueprints

Book Image

Web Design Blueprints

Overview of this book

The book delivers simple instructions on how to design and build modern Web using the latest trends in web development. You will learn how to design responsive websites, created with modern Flat User Interface design patterns, build deep-scrolling websites with parallax 3D effects, and roll-your-own single-page applications. Finally, you'll work through an awesome chapter that combines them all. Each chapter features actual lines of code that you can apply right away.
Table of Contents (12 chapters)
Web Design Blueprints
About the Author
About the Reviewer

Creating a callBack function for the API

The final piece in making this and the other local JavaScript work through the routing table is to wire it into the services.getPage function. This will be easy.

Using the callBack function

Before that, we first need to write a new callBack function to do something with the JavaScript that is in the content directories. And when it loads it, it loads into the header's SCRIPT element, where it runs. Create a new function as a method of the services.routing object called writeScript. It will receive the variables XHTTP, id, and hash.

services.routing.writeScript = function(xhttp,id,hash){
//Do Something

Inside it, first create a new variable called newScript equal to the document's createElement method, creating a SCRIPT element.

var newScript = document.createElement('script');

The newScript variable has a property, text; set it equal to the string var id=" plus the hash variable plus ";. See the following example:

newScript.text = 'var id= "'+hash+'...