Old piece of code I had to hunt out today, builds selector to the passed in element /* Get the jquery selector for the specified element */ jQuery.fn.getPath = function (removeClasses) { if (this.length != 1) throw ‘Requires one element.’;…Continue Reading →
This is a simple function that hides an item when the mouse leaves. The object can be visible initially and will only dissapear once the mouse has entered AND left. $(‘div.mouse.LeaveHide’).on({ mouseover:function(e){ $(e.target).one({ mouseleave:function(e){ $(e.target).hide(); } }); } });
There is an HTML5 (originally IE extension) property frameElement on window: alert(frameElement.id); But this is not globally supported; you won’t get it in Google Chrome (at the time of writing; version 7) or in older versions of the other popular non-IE browsers.
I had a requirement for a series of select boxes that required the related one to only allow selections above the first. I created a little utility function that enables and disables the options based on a function you supply….Continue Reading →
When processing sortables etc. Its handy to be able to get the index of individual items. Heres how you find the position of an li within a list: var position = $item.parent().find(’> li’).index($item) + 1;var position = $item.parent().find(‘> li’).index($item) +…Continue Reading →
Its been a while but I’m not far off releasing my cms and am just reworking the interface. Previously it had fixed panels at the top and left of the page but on some sites this caused the page to be…Continue Reading →