Skip to content

Instantly share code, notes, and snippets.

View adamboduch's full-sized avatar

Adam Boduch adamboduch

View GitHub Profile
@adamboduch
adamboduch / jquery.ui.dialog.on.hover.css
Created August 9, 2013 00:53
A preview jQuery UI dialog, displays and loads content on link hover. Based on the original implementation found here: http://jsbin.com/okosi4
body {
font-size: 0.8em;
margin: 5%;
}
@adamboduch
adamboduch / jquery.ab.application.js
Created August 2, 2013 18:07
You can do a lot with the jQuery UI widget factory and inheritance. For example, you can extend the capabilities of the menu widget by defining a new widget that inherits everything implemented in menu. You can do other interesting this like making sure each width has consistent access to application data.
(function( $, undefined ) {
// This is just a dummy application. A real one would have many more
// properties and methods, but the same concept applies. It isn't aware
// of any widgets that realize its capabilities.
function Application () {
this.minSize = 0;
this.maxSize = 10;
this.idealMinSize = 3;
this.idealMaxSize = 7;
@adamboduch
adamboduch / jquery.ab.tabs.js
Created August 1, 2013 15:32
Extending the jQuery UI tabs widget to support navigation using the tab key.
(function( $, undefined ) {
$.widget( "ab.tabs", $.ui.tabs, {
_tabKeydown: function( e ) {
// Handle the keydown behavior first.
this._super( e );
// Return early if we're not dealing with a TAB key.
@adamboduch
adamboduch / jquery.ui.selectable.table.row.css
Created July 30, 2013 14:23
Use jquery.ui.selectable to select table rows. This example will sum the balance column based on the selected rows.
body {
margin: 1.4em;
}
table {
min-width: 30%;
}
table > thead > tr > td {
padding: 0.3em;
}
table > tbody > tr {
@adamboduch
adamboduch / jquery.ab.datepicker.js
Created July 26, 2013 03:56
In chapter 4, of "jQuery UI Cookbook", effects are applied to days in addition to months. This isn't the intended behavior. The following code should properly differentiate between month adjustments, and other adjustments. Thanks to Dave Sharman for pointing out the issue.
(function( $, undefined ) {
$.extend( $.datepicker, {
monthAdjusted: false,
_adjustDate: function ( id, offset, period ) {
var _super = $.datepicker.constructor.prototype;
@adamboduch
adamboduch / jquery.ab.autocomplete.js
Last active December 20, 2015 04:58
In chapter 2, of "jQuery UI Cookbook", there are some issues with category sorting in IE 10. Thanks to Dave Sharman for providing the solution.
$.widget( "ab.autocomplete", $.ui.autocomplete, {
_renderMenu: function( ul, items ) {
var that = this,
currentCategory = "";
// This should be returning integers, not booleans.
items.sort( function( a, b ) {
if ( a.cat > b.cat ) {
@adamboduch
adamboduch / jquery.ui.cookbook.js
Created July 22, 2013 22:15
Need help with code from "jQuery UI Cookbook"? Drop me a line in the comments below and I'll create a new gist for you. http://www.packtpub.com/jquery-userinterface-cookbook/book
$( "#help" ).guide();