Thursday, September 8, 2016

Native Infinite Scrolling with the IntersectionObserver API

Recently an interesting new client-side JavaScript API appeared on the Web Platform, the IntersectionObserver API.

This tiny but useful API provides a means to efficiently monitor (observe) the visibility of specified DOM elements, that is, when they are in or out of a viewport (the viewport of the browser window or of an element). The definition of element visibility can be made precise specifying the fraction of the area of the element that intersects the viewport rectangle.

Some common applications and use cases for this feature include:

  • Lazy-loading of content
  • Infinite scrolling
  • Ads visibility
  • Animations triggered by scrolling (note: this is not a target use case. The visibility information reported by the API might come with a slight delay and pixel-perfect data are not guaranteed).

Browser Support

Being a fairly new API, its support at the time of this writing is still limited:

  • Chrome desktop 51
  • Chrome for Android 51
  • Android WebView 51
  • Opera 38
  • Opera for Android 38

However, an in-development polyfill (there is no support for the root margin) is available on Github, so we can start to play with Intersection Observers right now.

In this article, we'll implement the infinite scrolling UX pattern. We'll use the aforementioned polyfill and even several ES6/ES2015 features along the way such as promises, template strings, and arrow functions.

Infinite Scrolling

Imagine we have a long list of items that we want to browse with infinite scrolling, so that when the user approaches the bottom of the document the next batch of items are loaded and appended to the end of the list.

Here is what we'll be building:

Continue reading %Native Infinite Scrolling with the IntersectionObserver API%


by Giulio Mainardi via SitePoint

Quick Tip: The Many Ways to Create a Hash in Ruby

As Rubyists, we use Hashes for everything. They are just so danged easy and useful. I mean, how often do you need something keyed to something else? A lot, if you're like me. For example, I have four (4) kids, which is a lot. I like to carry around a Hash like this one so I don't forget their names:

$> kids = {1: "Logan", 2: "Emma", 3: "Lily", 4: "Becca"}

Well, this is how I started, but that is little more than a glorified array. Plus, I found myself needing all kinds of information about them, so I changed the hash:

$> kids = {logan: { gender: :boy, dob: Date.new(2000, 12,24), sports: [:soccer], favorite: false } ... }

You get the idea. This Hash has served me well for quite some time, but I thought I'd look into some different ways to create this hash to see if I could make it even more useful.

This is Your Grandparents' Hash Creation

Continue reading %Quick Tip: The Many Ways to Create a Hash in Ruby%


by Glenn Goodrich via SitePoint

AtoZ CSS Quick Tip: Color

This article is a part of our AtoZ CSS Series. You can find other entries to the series here.

Welcome to our next article as part of our AtoZ CSS series! In this series I'll be exploring different CSS values (and properties) beginning with a letter from the alphabet. Let's start by looking at the letter C.

C is for color

The color property is used to change the color of text on the page, but what about the color of selected text?

Using the ::selection pseudo element, text highlighted with the mouse can be styled. There are only a handful of properties that can be altered when styling the selected text. These are limited to:

  • color
  • background-color
  • cursor
  • outline
  • text-decoration
  • text-shadow

Continue reading %AtoZ CSS Quick Tip: Color%


by Guy Routledge via SitePoint

Creating Custom WordPress Administration Pages, Part 2

Anna Morosini

Anna is a young Italian photographer who translates body language into emotional pictures, creating natural beauty by mixing simplicity and sensuality.
by via Awwwards - Sites of the day

20 Social Media Tools and Tips From the Experts

ldj-tips-summit-pros-600

Looking for social media tips to step up your marketing game? Wondering what tools the pros recommend? We asked top social media experts to share the tools and tactics they’re using right now. In this article, you’ll discover 20 ways you can stay ahead of the social media marketing curve. #1: Animate Text and Image Posts [...]

This post 20 Social Media Tools and Tips From the Experts first appeared on .
- Your Guide to the Social Media Jungle


by Lisa D. Jenkins via

Excelsiorama

Excelsiorama - The UPSTNY Typeface

Awesome typeface collaboration led by Tyler Finck resulting in the unique 'Excelsiorama' free font. Real slick feature in the header that switches the font previews. Fun stuff!

by Rob Hope via One Page Love