iphone/ipad triggering unexpected resize events

Store the window width and check that it has actually changed before proceeding with your $(window).resize function: jQuery(document).ready(function($) { // Store the window width var windowWidth = $(window).width(); // Resize Event $(window).resize(function(){ // Check window width has actually changed and it’s not just iOS triggering a resize event on scroll if ($(window).width() != windowWidth) { … Read more

Responsive order confirmation emails for mobile devices?

How about something like this? This uses a fluid/liquid technique that works on all major clients, including those that do not support media queries (Gmail etc…): <!DOCTYPE HTML PUBLIC “-//W3C//DTD HTML 4.01//EN” “http://www.w3.org/TR/html4/strict.dtd”> <html><head><meta http-equiv=”Content-Type” content=”text/html; charset=utf-8″><title></title> <style type=”text/css”> #outlook a {padding:0;} body{width:100% !important; -webkit-text-size-adjust:100%; -ms-text-size-adjust:100%; margin:0; padding:0;} /* force default font sizes */ .ExternalClass … Read more

Detect mobile browser [duplicate]

Have my user agent code: <?php /* USER-AGENTS ================================================== */ function check_user_agent ( $type = NULL ) { $user_agent = strtolower ( $_SERVER[‘HTTP_USER_AGENT’] ); if ( $type == ‘bot’ ) { // matches popular bots if ( preg_match ( “/googlebot|adsbot|yahooseeker|yahoobot|msnbot|watchmouse|pingdom\.com|feedfetcher-google/”, $user_agent ) ) { return true; // watchmouse|pingdom\.com are “uptime services” } } else if … Read more

Which are the most important media queries to use in creating mobile responsive design?

I’d recommend taking after Twitter’s Bootstrap with just these four media queries: /* Landscape phones and down */ @media (max-width: 480px) { … } /* Landscape phone to portrait tablet */ @media (max-width: 767px) { … } /* Portrait tablet to landscape and desktop */ @media (min-width: 768px) and (max-width: 979px) { … } /* … Read more

Make Input Type=”Password” Use Number Pad on Mobile Devices

Some browsers (iOS) recognize the specific pattern attribute value of [0-9]* as triggering numeric keypad. The HTML 5.1 draft contains the inputmode attribute, which has been designed to address the specific issue of input mode (like key pad) selection, but it has not been implemented yet. You could use it for the future, though – … Read more

Understanding touch events

If you haven’t already, I would suggest reading the source code for Hammer.js https://github.com/hammerjs/hammer.js/blob/master/hammer.js Between comments and code it’s about 1400 lines, there is great documentation and the code is easy to understand. You can see how the author has chosen to solve a lot of the common touch events: hold, tap, doubletap, drag, dragstart, … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)