background preloader

JavaScript

Facebook Twitter

jQuery Selectortest. JavaScript Tabifier automatically create an html css tabs interface. Step One If you start with some simple HTML like this: <h3>Section One</h3> Section one content.

JavaScript Tabifier automatically create an html css tabs interface

Section two content. Add some structural DIV elements. Add a div with class=tabber around the whole thing: <div class="tabber"><h3>Section One</h3> Section one content. Then add a div with class=tabbertab around each section. <div class="tabber"><div class="tabbertab"><h3>Section One</h3> Section one content. Knockout JS: Helping you build dynamic JavaScript UIs with MVVM and ASP.NET. Your own sports news site with ESPN API and Knockout.js. I was really excited when I heard the announcement of the ESPN API.

Your own sports news site with ESPN API and Knockout.js

Being a sports freak like me, that opens a tremendous amount of possibilities for application development. Today, let’s build our own sports news single-page application, fueled entirely by Knockout.js. You will be able to browse the latest news from ESPN from all sports categories, as well as filter them by tags. The UI will be powered by KnockoutJS and Twitter bootstrap, and yes, will be a single page. We have already done two projects together using knockout.js – last.fm API infinite scroll and ASP.NET WebAPI file upload.

JavaScript: Test run javascript code online, right here. Get Querystring with JavaScript - Parse/Get QueryString with Client-Side JavaScript. jQuery Events: Stop (Mis)Using Return False. Probably one of the first topics covered when you get started learning about jQuery events is the concept of canceling the browser’s default behavior.

jQuery Events: Stop (Mis)Using Return False

For instance, a beginner click tutorial may include this: This function toggles the hiding and displaying of #mydiv, then cancels the browser’s default behavior of visiting the href of the anchor tag. It is in these very first examples that bad habits are formed as users continue to use return false; whenever they want to cancel the default browser action. I am going to cover two very important topics in this article relating to the canceling of browser events: Use the right method for the job: return false vs. preventDefault, stopPropagation, and stopImmediatePropagationTop, bottom or somewhere in the middle: where in the event callback should you cancel default behavior?

Run javascript onload but not in body tag ?? Essential JavaScript Design Patterns For Beginners. I would like to thank Rebecca Murphey for inspiring me to open-source this mini-book and release it for free download and distribution - making knowledge both open and easily available is something we should all strive for where possible. I would also like to extend my thanks to the very talented Alex Sexton who was kind enough to be the technical reviewer for this publication.

I hope that it helps you learn more about design patterns and the usefulness of their application to JavaScript. Volume 2 of Essential JavaScript Design Patterns is currently being written and will be more detailed than this first edition. The ETA for it's online release is late Q4, 2011. For more detailed coverage of specific patterns, you may be interested in my posts on the Pub/Sub (Observer) or Decorator patterns. At the beginning of this book I will be focusing on a discussion about the importance and history of design patterns in any programming language. JavaScript Guide. The JavaScript Guide shows you how to use JavaScript and gives an overview of the language. If you need exhaustive information about a language feature, have a look at the JavaScript reference.

This Guide is divided into the following chapters. Introduction Grammar and types Control flow and error handling Loops and iteration Functions Expressions and operators Numbers and dates Text formatting Indexed collections Keyed collections Working with objects Details of the object model Promises. JavaScript Garden.

Although JavaScript deals fine with the syntax of two matching curly braces for blocks, it does not support block scope; hence, all that is left in the language is function scope. function test() { // a scope for(var i = 0; i < 10; i++) { // not a scope // count } console.log(i); // 10} There are also no distinct namespaces in JavaScript, which means that everything gets defined in one globally shared namespace.

JavaScript Garden

Each time a variable is referenced, JavaScript will traverse upwards through all the scopes until it finds it. In the case that it reaches the global scope and still has not found the requested name, it will raise a ReferenceError. The Bane of Global Variables // script Afoo = '42'; // script Bvar foo = '42'

Documentation - JavaScript API (beta) Overview The SublimeVideo Player comes with an integrated JavaScript API.

Documentation - JavaScript API (beta)

Once loaded, SublimeVideo Player instantiates a unique API object called sublime. All calls to the API must be done through this object. For performance puroposes, SublimeVideo Player and the sublime API object are automatically loaded upon page load if there is at least an element with the sublime class in the DOM. If you have no videos (or lightboxes) initially on the page (and you plan for instance to add them dynamically later with JavaScript) you can use the sublime.load method to force the loading of the player and the sublimevideo API object. Online javascript beautifier.