Skip to content

Instantly share code, notes, and snippets.

@devdays
Last active Aug 29, 2015
Embed
What would you like to do?
Client code for displaying widget
$("#cheeses").filterable({
className: "cheese",
create: function() { $("#register").addClass("ui-widget-header cheese").show(); },
filtered: function(e, ui) {
var t = 0;
ui.visible.each(function() { t = t + parseFloat($(this).data("price")); });
console.log( t );
total.text(t.toFixed(2));
},
setOption: function(e, ui) {
ui.option == "className" && $("#register").toggleClass([ui.original, ui.current].join(" "));
},
hover: function(e, ui) {
if (e.originalEvent.type == "mouseenter") {
price.text(" - " + ui.hovered.data("price") + " per lb").appendTo(ui.hovered);
} else {
price.detach();
}
}
});
setTimeout(function() { cheeses.filterable("option", "className", "cheesePlease"); },3000);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment