Skip to content

Instantly share code, notes, and snippets.

@zjlgdx
zjlgdx / dialog.js
Created September 23, 2012 02:29
jquery ui dialog + knockoutjs
ko.bindingHandlers.dialog = {
init: function(element, valueAccessor, allBindingsAccessor) {
var options = ko.utils.unwrapObservable(valueAccessor()) || {};
options.close = function() {
allBindingsAccessor().dialogVisible(false);
};
$(element).dialog(options);
@zjlgdx
zjlgdx / jquery.ba-tinypubsub.js
Created November 2, 2012 13:42 — forked from cowboy/HEY-YOU.md
jQuery Tiny Pub/Sub: A really, really, REALLY tiny pub/sub implementation for jQuery.
/* jQuery Tiny Pub/Sub - v0.7 - 10/27/2011
* http://benalman.com/
* Copyright (c) 2011 "Cowboy" Ben Alman; Licensed MIT, GPL */
(function($) {
var o = $({});
$.subscribe = function() {
o.on.apply(o, arguments);
@zjlgdx
zjlgdx / css
Created July 21, 2015 07:47
justified-nav
// hightlight actived menu item
.nav-justified > .active > a,
.nav-justified > .active > a:hover,
.nav-justified > .active > a:focus {
background-color: #ddd;
background-image: none;
box-shadow: inset 0 3px 7px rgba(0,0,0,.15);
}
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width" />
<title>Index</title>
<link href="~/Content/normalize.min.css" rel="stylesheet" />
<link href="~/Content/twitterdemo.css" rel="stylesheet" />
</head>
<body>