View RSS Feed

All Blog Entries

  1. Img Src to Background-Image - Dealing with images inserted via a CMS

    This small JavaScript function converts the src attribute of an <img> tag into a CSS background-image, where background-size:cover; kicks in for visual containment and faux-cropping. In other words, it forces image size to be consistent.

    While I've been working with folks who update their own web pages - training them to use a CMS and the likes - one common issue that crops up has to do with the arrangement of images on a web page. Inevitably, at some point, ...

    Updated 06-25-2016 at 07:21 AM by Beverleyh

    JavaScript & Ajax , CSS related , Web Design issues
  2. iOS 'Sticky Hover' Fix - Unhovering dropdown CSS menus

    One line of JavaScript to fix the 'sticky hover' problem on iOS; Where hover CSS isn't removed from an active element until another focusable element (button, link) is clicked. With this script, a tap of the surrounding area will remove hover CSS.

    What's the problem?
    In the opening paragraph, I state that a problem with hover activated CSS on iOS is that hover styles aren't removed until another element takes focus. A notable case for this is with CSS-only dropdown menus - ...

    Updated 05-30-2016 at 12:20 PM by Beverleyh

    JavaScript & Ajax , CSS related , Web Design issues
  3. A URL-driven tabbing system

    There are many 'tab content scripts' on the web that let you organize hidden DIV contents into a tab interface, with the desired content appearing when a tab is clicked on.
    But most of the time, these scripts merely do that and nothing else. They don't add entries to the browser's history, which implies that the 'panels' are not bookmarkable / that the native browser's back/forward button does not change the state of the selected tabs. And if the scripts use the hash tag for correcting this, ...

    Updated 06-05-2016 at 10:18 PM by molendijk

  4. The Easy Way to Absolute Center (vertical + horizontal alignment)

    I hit a snag recently when I wanted to absolutely center a responsive image and couldn't use my 'go-to' method of CSS3 transforms, due to other conflicting CSS3 keyframe animations that were cancelling it out;
    img { 
    	max-width: 100%; 
    	max-height: 100%; 
    	position: absolute; 
    	top: 50%; 
    	left: 50%; 
    	-webkit-transform: translate(-50%,-50%);
    	-ms-transform: translate(-50%,-50%);
    	transform: translate(-50%,-50%)
    Here's ...

    Updated 05-28-2016 at 07:23 AM by Beverleyh

    CSS related , Web Design issues
  5. Using the Google Document Viewer for embedding PDF / opening it in a new window/ tab

    Often PDF-files will not open in Internet Explorer if we just use the regular PDF-URL in the address bar or for the iframe in which we want to embed the file. And often PDF-files are not readable on iOS, or only display the first page of the document.
    These problems don't seem to occur if we use the Google Document Viewer for displaying PDF. Here's some useful code for using the viewer. Its only disadvantage is that it does not allow momentum scroll on iOS.

    Updated 05-23-2016 at 09:19 AM by molendijk (English)

Page 2 of 27 FirstFirst 123412 ... LastLast