Some Useful JavaScript & jQuery Snippets - Part 3 How to hide all children div except a specific one with jQuery? $('#target div:not(#exclude)').hide(); //or $('#target').children().filter(':not(#exclude)').hide(); Detecting when a div’s height changes using jQuery $('element').bind('resize', function(){ alert( 'Height changed to' + $(this).height() ); } Delete all table rows except first $('someTableSelector').find('tr:gt(0)').remove(); Selecting root element of a certain level in the document 1 level: $('*:not(* *)'); […] How to hide all children div except a specific one with jQuery? Detecting when a div’s height changes using jQuery Delete all table rows except first Selecting root element of a certain level in the document Searching a string in jQuery Get the distance scrolled from top Select all elements except the ones with a given classAdd a row to a table How to convert decimal to hexadecimal? Filtering By More Than One Attribute in JQuery How to expire a cookie in x minutes Selecting the first x items with jQuery
Revised Font Stack | A Way Back Serious efforts are being made to get more typeface choices on the web to enhance web typography. Still, most of us prefer web-safe fonts like: Verdana, Georgia, Times New Roman and Arial. Though choices are limited, yet the number can be increased by exploring other pre-installed fonts. “… font stacks are ultimately design factors, and should be scrutinized as such.” Baskerville, Garamond and Palatino have already been used a few times to create font-stacks that inspire. I’ve selected 10 popular typefaces, serif and sans-serif, each from the survey. MicrosoftTahoma, Verdana, Segoe, sans-serif;Microsoft.com will be (in most cases) rendered in Verdana on Mac, and in Tahoma on Windows. Times New RomanIf we look at the above snapshots taken from Sushi & Robots’ about page, we will find that Palatino and Georgia have different x-height (and weight) than Baskerville and Garamond. I’ve created a font-stack for each typeface while considering the font share table statistics.
css W3Fools – A W3Schools Intervention Visual thesaurus using arbor.js Wow, I can’t believe we are at the end of January – one twelfth of the year gone already! I’ve been so busy this month I’ve barely had time to sit down and work on any personal projects. Thankfully I had a spare few hours over the weekend to work on a project I’ve been meaning to finish for a couple of weeks: a visual thesaurus using JavaScript. Visual thesaurus representation of the word 'clean'. You may (or may not) know of the Visual Thesaurus by Thinkmap; very useful but it’s a paid for service, I use it so infrequently I can’t justify paying for it (there is a free trial though). Arbor.js took a little getting used to as it uses a mixture jQuery, canvas and its own methods; but there’s a fairly extensive set of documentation and a set of usage examples. So to the demo; I’ve tried to keep it very simple to use. Any suggestions, comments or feature improvements please leave a comment below!
Increasing the Clickable Area of Inline Links Demo It has been best practice for some time now to ensure that navigation links have appropriate padding. This makes clicking these links much easier, especially if you are on a mobile device. Here is an article, written four years ago, discussing this very idea. Why aren’t we taking this one step further? Links don’t only exist in menus, and inline links can be tricky to click accurately. Now keep in mind that this is only a thought. The trick is to be subtle with this technique; increase the click area enough that users don’t have to be 100% accurate, but don’t increase it too much so that the behavior becomes unexpected. Here is an example of what the CSS rule might look like: Notice the use of position: relative? What are your thoughts on this technique? Tweet this
Responsive Web Design Patterns | This Is Responsive Responsive Patterns A collection of patterns and modules for responsive designs. Submit a pattern Layout Reflowing Layouts Equal Width Off Canvas Source-Order Shift Lists Grid Block Navigation Single-Level Multi-level Breadcrumbs Pagination Images Responsive Image Techniques Media/Data Video Fluid Video Iframes Tables Charts & Graphs Responsive Chart Forms Basic Forms Text Lettering Fittext Footnotes Responsive Footnotes Modules Carousel Tabs Accordion Messaging Lightbox
Firefox's birthday present to us: Teaching tech titans about DIY upstarts High performance access to file storage Open ... and Shut It's hard to believe it now, but not too long ago the web was dangerously close to being owned by one vendor: Microsoft. As mainstream users came to equate Internet Explorer's logo with the Web, Microsoft worked to lock in its advantage with increasingly proprietary technology like ActiveX. It surely would have done so, too, but for the seemingly futile Mozilla browser, née Firefox. Precisely because it is about more than technology. Yes, that Firefox, the one that for years gobbled away at IE's 95 per cent market share, only to be largely supplanted in the hearts and minds of the geek elite by Google Chrome (though not in actual market share). Given technology's focus on the latest and greatest, it's easy to forget that much of this "latest and greatest" wouldn't even be possible without the work Mozilla did for years with Firefox. Quixotic as it may sound, the purpose of Firefox was always to spread Web freedom. As Lilly notes:
Arbor Js - Node Onclick LESS « The Dynamic Stylesheet language Code smells in CSS 20 November, 2012 Chris Coyier recently answered someone’s question: How can you tell if your CSS code smells? What are the signs that the code is sub-optional, or that the developer hasn’t done a good job? I thought I would extend Chris’ great answer with my own, additional take on things… My day-to-day life is spent working in-house at BSkyB… I work on big websites, the last of which took me over a year to build the front-end for (and it’s still ongoing). I’m going to share just a few things (there will, no doubt, be things that I have missed) that I look out for in CSS that will give you and idea as to its quality, its maintainability and its integrity… Undoing styles Any CSS that unsets styles (apart from in a reset) should start ringing alarm bells right away. Any CSS declarations like these: border-bottom:none; padding:0; float:none; margin-left:0; …are typically bad news. Here we have ten lines of CSS and one ugly class name. Magic numbers These are a particular bugbear of mine. ! ! IDs
The ABCs of Web Development Web development can often be an utterly perplexing affair. Today, aimed at beginners, I'd like to introduce you to twenty six concepts or technologies, each mapping to a letter of the alphabet. Sounds wonky? It probably is! Let's get started after the jump. Republished Tutorial Every few weeks, we revisit some of our reader's favorite posts from throughout the history of the site. AJAX stands for Asynchronous JavaScript And XML and is the main driving force behind all these super smooth web applications you've been using over the past few years. AJAX, as a technology, has been pretty much all pervasive. At the center of everything is the XMLHttpRequest which allows calls to be sent and received, after a page has been fully rendered without touching the rest of the page. Related reading B -- Browser A browser is the understated structure on which you frame your magnificent masterpieces, be it websites or applications. CSS is one prong of the front end development trident. E -- Events
Checking if an element is visible on-screen using jQuery by Sam Sehnert Download jQuery VisibleView Demo We recently built a little jQuery plugin which allows us to quickly check if an element is within the browsers visual viewport, regardless of the scroll position. If a user can see this element, the function will return true. ? This method differs from the jQuery :visible selector in that visible checks to see whether the element is hidden using css (basically if offsetWidth or offsetHeight is 0). Usage In its simplest form, the element can be used as follows: $('#element').visible() This method will return true if the entire element is visible (I.e., it will return false if any part of that element is outside the viewport.Passing true to the ‘visible’ method, will tell the plugin to return true if ANY part of the element is visible on the users screen. $('#element').visible( true ) Limitations The plugin ignores the elements visibility (E.g., display:none; visibility: hidden; offsetWidth or offsetHeight is 0). $('#element:visible').visible()
CSS Overlay Techniques There are several techniques for creating overlays: from using an absolutely positioned element to outlines and pseudo-elements. In this article we are going to explore each technique's styles with their pros and cons. Design patterns, a set of best practices and techniques that aim to solve some of the most common design “problems”, are usually presented in the context of design principles. One of these design principles is the “Stay On Page” principle. This principle is based on the fact that page refreshes are disruptive to the user’s mental flow, causing what is known as “change blindness”, and that we need to be able to avoid breaking the visual flow of the user wherever and whenever we can. We can decide intelligently when to keep the user on the page and model his process. Lightweight overlays can be used for asking questions, obtaining input, introducing features, indicating progress, giving instructions, or revealing information. Technique #1: Absolutely positioned element