JSFiddle

  • Backbone Template

    Standard fiddle

        SearchView = Backbone.View.extend({
            initialize: function(){
                this.render();
            },
            render: function(){
                var template = _.template( $("#search_template").html(), {} );
                this.el.html( template ...
  • A Backbone.js Playground #3 is the latest revision

    A simple playground for learning backbone.js without having to install or configure anything yourself.

    var Comment = Backbone.Model.extend({
        defaults: {
            username: null,
            submissionId: 12
        },
    
        initialize: function () {
            this.on("change:username", function (model) {
                var name ...
  • Sticky Bar #1 is the latest revision

    No-Library (pure JS), HTML, CSS, JavaScript

    $(function() {
        $(document).on('scroll', function() {
            var scrolled = $(document).scrollTop();
            var $targetDiv = $('#wat');
            var divOffset = $targetDiv.offset().top;
            
            if (scrolled > divOffset ...
  • Bootstrap 3 Skeleton #2 is the latest revision

    This is a simple Bootstrap skeleton. You can fork it to get a ready to use Bootstrap fiddle.

    (function ($) {
        var radioButtons = {
            init: function () {
                this.each(function () {
                    var $container = $(this);
                    var $radios = $container.find(':radio');
                    var $labels = $container.find ...
  • localStorage Test Functions

    This function uses the localStorage method to save/modify key/value pair data to the browser..

    var objBox1 = document.id('box1');
    var objBox2 = document.id('box2');
    var objBox3 = document.id('box3');
    var myObject = {
        "foo": "bar",
        "abc ...
  • Radio Buttons #9 is the latest revision

    jQuery 1.7.1, HTML, CSS, JavaScript

    (function ($) {
        var radioButtons = {
            init: function () {
                this.each(function () {
                    var $container = $(this);
                    var $radioBtn = $container.find(':radio');
    
                    $radioBtn.on('click', $radioBtn ...
  • Maintainable jQuery Comment App #2 is the latest revision

    http://www.intelligiblebabble.com/how-to-write-maintainable-jquery-applications/?utm_source=javascriptweekly&utm_medium=email

    "use strict";
    (function($, application, window) {
    
        Handlebars.registerHelper('json', function (context) {
            return JSON.stringify(context);
        });
    
    
        application.CommunicationLayer = function (spec) {
            var self ...
  • FAQ Accordion #3 is the latest revision

    jQuery 1.8.3, HTML, CSS, JavaScript

    (function() {
        
        $('dd').filter(':nth-child(n+4)').addClass('hide');
    
        $('dl').on('mouseenter', 'dt', function() {
            $(this)
                .next()
                    .slideDown(200)
                    .siblings('dd')
                        .slideUp ...
  • Deferred w/ a Promise

    jQuery 1.8.3, HTML, CSS, JavaScript

    function asyncEvent(){
        var dfd = new jQuery.Deferred();
    
        // Resolve after a random interval
        setTimeout(function(){
            dfd.resolve("hurray");
        }, Math.floor(400 ...
  • Backbone app #5 is the latest revision

    jQuery 1.8.3, HTML, CSS, JavaScript

    (function($) {
        HoverView = Backbone.View.extend({
            el: $('body'),
            
            initialize: function() {
                this.addZoomContainer();
            },
            
            events: {
                'mouseenter .js-hover-zoom-orig-img ' : 'showZoomContainer',
                'mouseleave .js-hover-zoom-orig-img' : 'hideZoomContainer'
            },
            
            showZoomContainer: function ...