Tuesday, July 31, 2018

How to use Media Queries in JavaScript with matchMedia

When it was first introduced, responsive design was one of the most exciting web layout concepts since CSS replaced tables. The underlying technology uses media queries to determine the viewing device type, width, height, orientation, resolution, aspect ratio, and color depth to serve different stylesheets.

If you thought responsive design was reserved for CSS layouts only, you'll be pleased to hear media queries can also be used in JavaScript, as this article will explain.

Media Queries in CSS

In the following example, cssbasic.css is served to all devices. But, if it's a screen with a horizontal width of 500 pixels or greater, csswide.css is also sent:

[code language="html"]
<link rel="stylesheet" media="all" href="cssbasic.css" />
<link rel="stylesheet" media="(min-width: 500px)" href="csswide.css" />
[/code]

The possibilities are endless and the technique has long been exploited by most websites out there on the Internet. Resizing the width of your browser triggers changes in the layout of the webpage.

With media queries nowadays it's easy to adapt the design or resize elements in CSS. But what if you need to change the content or functionality? For example, on smaller screens you might want to use a shorter headline, fewer JavaScript libraries, or modify the actions of a widget.

It's possible to analyze the viewport size in JavaScript but it's a little messy:

  • Most browsers support window.innerWidth and window.innerHeight. (IE before version 10 in quirks mode required document.body.clientWidth and document.body.clientHeight.)
  • window.onresize
  • All the main browsers support document.documentElement.clientWidth and document.documentElement.clientHeight but it's inconsistent. Either the window or document dimensions will be returned depending on the browser and mode.

Even if you successfully detect viewport dimension changes, you must calculate factors such as orientation and aspect ratios yourself. There's no guarantee it'll match your browser's assumptions when it applies media query rules in CSS.

The post How to use Media Queries in JavaScript with matchMedia appeared first on SitePoint.


by Craig Buckler via SitePoint

"Instances of Spam Mails Sent Decrease", Reports Kaspersky Lab

Ever felt irritated by the outrageous number of junk emails spamming your account? When you would open up your inbox to view potential important mails, but instead come across fake princes asking for money, and brands sending click baits? We all have been there. But the Kaspersky lab, a...

[ This is a content summary only. Visit our website https://ift.tt/1b4YgHQ for full links, other content, and more! ]

by Neha Zaidi via Digital Information World

WhatsApp Tests on a "Mark as Read" Feature with a Small Percentage of Users

It appears so that WhatsApp is testing with a new feature, which is similar to the one in Telegram. This tool is being rolled out a very select users with the latest WhatsApp version functioning in their mobiles, i.e. v2.18.232 beta. With this new development, users will ow be able to mark...

[ This is a content summary only. Visit our website https://ift.tt/1b4YgHQ for full links, other content, and more! ]

by Neha Zaidi via Digital Information World

WhatsApp Introduces Conference Call Feature for Its Users

As WhatsApp boasts a staggering 1.5 billion people as its active monthly users, it strives to bring innovations in the application which would make user experience better. In the previous year's Facebook's F8 developer conference, it was reported that WhatsApp would soon have a new feature...

[ This is a content summary only. Visit our website https://ift.tt/1b4YgHQ for full links, other content, and more! ]

by Neha Zaidi via Digital Information World

The Top 5 One Pagers from July 2018

one-page-love-hosting-reviews-bh-unlimited

This "Most Loved" One Page website round-up is brought to you by hosting provider, Bluehost.

Bluehost is the most affordable hosting option to host your One Page websites. They have an incredible $2.95/month deal exclusive to One Page Readers where you can host your website with 50GB diskspace and unlimited bandwidth. They also throw in a free domain!

If you want to get notified about the "Most Loved" awards each month, subscribe to our Inspiration Newsletter.

Below are the Top 5 One Page websites awarded “Most Loved” in July – hope you enjoy!


5. Eleven Plants for Dum-Dums & Cool Ppl (Informational)

Beautifully designed informational One Pager built using Webflow showcasing eleven plants – each paired with a lovely typeface to express its leafy personality. On a typeface-related note, I published a video tutorial on how to identify fonts in a webpage.


4. Bellevoye (Product, Landing Page)

Elegant One Pager for Bellevoye French Whisky featuring slick load transitions, parallax scrolling elements and beautifully styled product images in the info modals.


3. Apostrophe Copywriters (Portfolio, Service)

Loads to love in this wonderfully unique One Pager for Apostrophe Copywriters. Check out the fun alphabetical client shout-outs, the gorgeous big typography, the team bios written by each other, the original contact form and not to mention the fittingly cheeky copy.


2. Mariano Pascual (Portfolio)

Brilliantly unique One Pager filled with personality for Argentinian designer, Mariano Pascual. The website mimics an interactive desktop on a vintage Operating System featuring a taskbar, menubar and draggable windows. One of the most unique and inspiring websites you’ll see this year.


1. Epicurrence No.7 (Event, Announcement)

Dann Petty is back with another awesome Epicurrence event and of course announced with an even more awesome One Page website. The design just oozes style from unique button hover effects, slick parallax scrolling, a beautiful color scheme and gorgeous illustrations. Really love how they added inline credits to certain elements in the page that link out to the relevant designer or developer.


Hope you enjoyed these beautiful One Pagers from July!

Big love to hosting provider Bluehost for sponsoring the round up < 3


by Rob Hope @robhope via One Page Love

Amelia: The Next-level WordPress Booking Plugin

This article was created in partnership with BAWMedia. Thank you for supporting the partners who make SitePoint possible.

Booking appointments would seem to be a minor task, but managing appointments takes up more time, energy, and money than you might imagine, especially in very active businesses like consulting firms, health and fitness clubs, and beauty salons.

Manual booking methods often work reasonably well, but they are by no means flawless. Mistakes will be made, appointments will slip through the cracks, and appropriate parties can fail to be properly informed when changes occur.

An excellent way to avoid these pitfalls is to simplify the booking process while at the same time making it totally reliable and error-free. That way has a name. It’s Amelia, and Amelia even works while you sleep.

Introducing Amelia, the Automated Booking Specialist

Amelia

Its users will tell you that it was high time for a tool like Amelia, a WordPress plugin that makes and manages appointments without fail and does so 24/7. Amelia was created with individuals and businesses like coaches and personal trainers, private clinics and health clubs, consultants, and beauty salons in mind.

Amelia requires no technical expertise whatsoever to install, it’s easy to set up, and once that’s done it’s 100% automated. Clients can make appointments at any time day or night with just a few clicks, and you can set your calendar, view those appointments and manage your business team, flawlessly and from one place.

Install Amelia, and you’ve just replaced sticky notes, scurrying, and meeting attendance goofs with a reliable appointment system that operates flawlessly on autopilot.

Amelia's Top Benefits


Amelia

You’ll save more money than you’d think. You don’t pay Amelia hourly, nor is Amelia a salaried employee. You simply pay a one-time fee for what Amelia will do for you forever, and that fee is so low that your ROI is almost instantaneous. From the minute Amelia is set up and running, you’re saving money.

The post Amelia: The Next-level WordPress Booking Plugin appeared first on SitePoint.


by SitePoint Team via SitePoint

How Much Data You Need and How to Use Less (infographic)

For someone on the go, it is incredibly important to have a good data plan. While more and more people are moving to unlimited data plans, many people have a data limit of 3-20 Gigabyte (GB). As such, it is important to ration your data usage so as not to burn through it in a few days. In a world...

[ This is a content summary only. Visit our website https://ift.tt/1b4YgHQ for full links, other content, and more! ]

by Irfan Ahmad via Digital Information World