Skip to content

Instantly share code, notes, and snippets.

View commadelimited's full-sized avatar

Andy Matthews commadelimited

View GitHub Profile
@commadelimited
commadelimited / 2011-11-14-01.js
Created January 19, 2012 19:30
Capturing the expand and collapse event
$(function(){
$('form').bind('expand',function(){
if (this.id == 'phone') {
$('#phone h3 a').addClass('removeCorner');
} else {
$('#phone h3 a').removeClass('removeCorner');
}
});
});
@commadelimited
commadelimited / 2011-09-19-01.css
Created January 19, 2012 19:35
Developing responsive websites
/* Smaller than standard 960 (devices and browsers) */
@media only screen and (max-width: 959px) { }
/* Tablet Portrait size to standard 960 (devices and browsers) */
@media only screen and (min-width: 768px) and (max-width: 959px) { }
/* Mobile Landscape Size to Tablet Portrait (devices and browsers) */
@media only screen and (min-width: 480px) and (max-width: 767px) { }
/* Mobile Portrait Size to Mobile Landscape Size (devices and browsers) */
@commadelimited
commadelimited / 2011-09-19-02.html
Created January 19, 2012 19:36
Developing responsive websites
<link type="text/css" media="only screen and (max-device-width: 480px)" href="small.css" rel="stylesheet" />
@commadelimited
commadelimited / 2011-02-23-01.html
Created January 19, 2012 19:43
Add swipe menu
<div data-role="page" id="swipemenu">
<div data-role="header">
<h1>jQuery Mobile - Swipe Menu</h1>
</div>
<div data-role="content">
<ul data-role="listview" data-inset="true" >
<li data-role="list-divider">Swipe Menu</li>
<li>
<a href="/code/jquerymobile/page.html">Item One</a><br />
<i>And sub text</i>
@commadelimited
commadelimited / 2011-02-23-02.js
Created January 19, 2012 19:44
Add swipe menu
if ( event.target.id.indexOf('swipemenu') >= 0) {
// remove any existing swipe areas
$('.divSwipe').remove();
// add swipe event to the list item, removing it first (if it exists)
$('ul li').unbind('swiperight').bind('swiperight', function(e){
// reference the just swiped list item
var $li = $(this);
// remove all swipe divs first
$('.divSwipe').remove();
// create buttons and div container
@commadelimited
commadelimited / 2011-02-23-03.css
Created January 19, 2012 19:47
Add swipe menu
.divSwipe {
text-align: center;
position: absolute;
z-index: 5;
width: 100%;
min-height: 64px;
background: #dddddd;
display: none;
}
.aSwipeBtn {
@commadelimited
commadelimited / 2011-02-18-01.html
Created January 19, 2012 19:51
Add swipe to delete
<div data-role="page" id="swipedelete">
<div data-role="header">
<h1>jQuery Mobile - Swipe to Delete</h1>
</div>
<div data-role="content">
<ul data-role="listview" data-inset="true" >
<li data-role="list-divider">Swipe to Delete</li>
<li><a href="page.html">Item One</a></li>
<li><a href="page.html">Item Two</a></li>
<li><a href="page.html">Item Three</a></li>
@commadelimited
commadelimited / 2011-02-18-02.js
Created January 19, 2012 19:52
Add swipe to delete
$(function(){
$('div').live('pageshow',function(event,ui){
if ( event.target.id.indexOf('swipedelete') >= 0) {
// remove any existing swipe areas
$('.aDeleteBtn').remove();
// add swipe event to the list item
$('ul li').bind('swiperight', function(e){
// reference the just swiped list item
var $li = $(this);
// remove all buttons first
@commadelimited
commadelimited / 2011-02-18-03.css
Created January 19, 2012 20:37
Add swipe to delete
.aDeleteBtn {
-moz-border-radius: 5px;
-webkit-border-radius: 5px;
float: right;
height: 15px;
line-height: 15px;
margin: 3px 10px 0 0;
padding: 0.6em;
position: absolute;
right: 0;
@commadelimited
commadelimited / 2011-02-13-01.html
Created January 19, 2012 20:43
Creating and using custom icons
<a href="page.html" data-role="button" data-theme="b" data-iconpos="right" data-icon="myapp-settings">Custom Icon</a>