This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //create a var for tracking if the element | |
| //is currently moving or not | |
| var moving = false; | |
| $('a').on('click', function(){ | |
| var moveMe = $('#moveMe'); | |
| //if the element is moving clear the queue | |
| //and stop the animation | |
| if( moving ){ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $(function(){ | |
| var div = $( '#doStuff' ); | |
| //add the delay to the queue | |
| div.delay( 1000, 'myQ') | |
| .queue( 'myQ', function(){ | |
| //this still refers to the current element | |
| $( this ).prepend( '<p>Waited 1 second</p>' ) | |
| .find('p') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ;(function(){ | |
| var anchor = document.querySelectorAll( 'a' )[0], | |
| span = document.querySelectorAll( 'span' )[0], | |
| div = document.querySelectorAll( 'div' )[0]; | |
| div.addEventListener( 'click', function( e ){ | |
| console.log( e.target, e.currentTarget ); //anchor, div | |
| e.preventDefault(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| grunt.initConfig({ | |
| less: { | |
| development : { | |
| src : [ 'less/**/*.less' ], | |
| dest : 'css/compiled-better.css' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| handlebars: { | |
| options: { | |
| namespace : 'Handlebars.templates', | |
| processName : function ( filename ){ | |
| var fileParts = filename.split('/'); | |
| return fileParts.slice( fileParts.length-1 )[0].split( '.' )[0]; | |
| } | |
| }, | |
| compile: { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| javascript:(function(){function e(){var b="";return d.each(function(a,c){b+=$(c).get(0).outerHTML}),b}function f(a){var b=a.text().split(" ");return b[b.length-1]}var d,a=$("#svPortal"),b=a.find("dl");document.createDocumentFragment(),d=b.sort(function(a,b){var c=$(a).find(".portalTitle>a"),d=$(b).find(".portalTitle>a");return c=f(c),d=f(d),console.log(c,d),d>c?-1:c>d?1:0}),a.html(e(d))})(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var a = { | |
| foo : function(){ | |
| console.log ( this ); | |
| var bar = function(){ | |
| console.log( this ); | |
| }; | |
| bar(); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var Foo = function(){}; | |
| Foo.prototype = new Bar(); | |
| var foo = new Foo(); | |
| foo.constructor === Foo; ///alse |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var Widget = function(){ | |
| this.messages = []; | |
| }; | |
| Widget.prototype.type='Widget'; | |
| var SubWidget = function( name ){ | |
| this.name = name; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var Widget = function( name ){ | |
| this.messages = []; | |
| }; | |
| Widget.prototype.type='Widget'; | |
| var SubWidget = function( name ){ | |
| this.name = name; | |
| Widget.apply( this, Array.prototype.slice.call( arguments ) ); | |
| }; |