Android active state hack

This commit is contained in:
Max Lynch
2013-08-23 18:31:41 -05:00
parent 289d7afdec
commit a1b2269e6d
5 changed files with 30 additions and 10 deletions

View File

@ -248,7 +248,7 @@ a.list-item:hover, a.list-item:focus {
.button-default:hover { .button-default:hover {
color: #333333; color: #333333;
text-decoration: none; } text-decoration: none; }
.button-default:active { .button-default.active, .button-default:active {
background-color: #e6e6e6; background-color: #e6e6e6;
box-shadow: inset 0px 1px 3px rgba(0, 0, 0, 0.15); } box-shadow: inset 0px 1px 3px rgba(0, 0, 0, 0.15); }
@ -259,7 +259,7 @@ a.list-item:hover, a.list-item:focus {
.button-secondary:hover { .button-secondary:hover {
color: #333333; color: #333333;
text-decoration: none; } text-decoration: none; }
.button-secondary:active { .button-secondary.active, .button-secondary:active {
background-color: gainsboro; background-color: gainsboro;
box-shadow: inset 0px 1px 3px rgba(0, 0, 0, 0.15); } box-shadow: inset 0px 1px 3px rgba(0, 0, 0, 0.15); }
@ -270,7 +270,7 @@ a.list-item:hover, a.list-item:focus {
.button-primary:hover { .button-primary:hover {
color: white; color: white;
text-decoration: none; } text-decoration: none; }
.button-primary:active { .button-primary.active, .button-primary:active {
background-color: #3d7be2; background-color: #3d7be2;
box-shadow: inset 0px 1px 3px rgba(0, 0, 0, 0.15); } box-shadow: inset 0px 1px 3px rgba(0, 0, 0, 0.15); }
@ -281,7 +281,7 @@ a.list-item:hover, a.list-item:focus {
.button-info:hover { .button-info:hover {
color: white; color: white;
text-decoration: none; } text-decoration: none; }
.button-info:active { .button-info.active, .button-info:active {
background-color: #34c6df; background-color: #34c6df;
box-shadow: inset 0px 1px 3px rgba(0, 0, 0, 0.15); } box-shadow: inset 0px 1px 3px rgba(0, 0, 0, 0.15); }
@ -292,7 +292,7 @@ a.list-item:hover, a.list-item:focus {
.button-success:hover { .button-success:hover {
color: white; color: white;
text-decoration: none; } text-decoration: none; }
.button-success:active { .button-success.active, .button-success:active {
background-color: #6fac45; background-color: #6fac45;
box-shadow: inset 0px 1px 3px rgba(0, 0, 0, 0.15); } box-shadow: inset 0px 1px 3px rgba(0, 0, 0, 0.15); }
@ -303,7 +303,7 @@ a.list-item:hover, a.list-item:focus {
.button-warning:hover { .button-warning:hover {
color: white; color: white;
text-decoration: none; } text-decoration: none; }
.button-warning:active { .button-warning.active, .button-warning:active {
background-color: #eba612; background-color: #eba612;
box-shadow: inset 0px 1px 3px rgba(0, 0, 0, 0.15); } box-shadow: inset 0px 1px 3px rgba(0, 0, 0, 0.15); }
@ -314,7 +314,7 @@ a.list-item:hover, a.list-item:focus {
.button-danger:hover { .button-danger:hover {
color: white; color: white;
text-decoration: none; } text-decoration: none; }
.button-danger:active { .button-danger.active, .button-danger:active {
background-color: #cc3724; background-color: #cc3724;
box-shadow: inset 0px 1px 3px rgba(0, 0, 0, 0.15); } box-shadow: inset 0px 1px 3px rgba(0, 0, 0, 0.15); }
@ -325,7 +325,7 @@ a.list-item:hover, a.list-item:focus {
.button-dark:hover { .button-dark:hover {
color: white; color: white;
text-decoration: none; } text-decoration: none; }
.button-dark:active { .button-dark.active, .button-dark:active {
background-color: #2b2b2b; background-color: #2b2b2b;
box-shadow: inset 0px 1px 3px rgba(0, 0, 0, 0.15); } box-shadow: inset 0px 1px 3px rgba(0, 0, 0, 0.15); }

View File

@ -66,6 +66,7 @@
<script src="../js/jquery/jquery-1.10.2.js"></script> <script src="../js/jquery/jquery-1.10.2.js"></script>
<script src="../js/framework/framework-utilities.js"></script> <script src="../js/framework/framework-utilities.js"></script>
<script src="../js/framework/framework-navigation.js"></script> <script src="../js/framework/framework-navigation.js"></script>
<script src="../js/framework/framework-buttons.js"></script>
<script src="../js/framework/test/event-listeners.js"></script> <script src="../js/framework/test/event-listeners.js"></script>
<script src="../js/framework/framework-init.js"></script> <script src="../js/framework/framework-init.js"></script>
</body> </body>

View File

@ -0,0 +1,20 @@
(function(window, document, framework) {
framework.Button = function() {}
framework.Button.prototype._onTouchStart = function(event) {
console.log('Touch start!', event);
if(event.target && event.target.classList.contains('button')) {
event.target.classList.add('active');
}
};
framework.Button.prototype._onTouchEnd = function(event) {
console.log('Touch end!', event);
if(event.target && event.target.classList.contains('button')) {
event.target.classList.remove('active');
}
};
document.addEventListener('touchstart', framework.Button.prototype._onTouchStart);
document.addEventListener('touchend', framework.Button.prototype._onTouchEnd);
})(this, document, this.FM = this.FM || {});

View File

@ -13,7 +13,7 @@
// want it on desktop // want it on desktop
//background-color: lighten($bgColor, 10%); //background-color: lighten($bgColor, 10%);
} }
&:active { &.active, &:active {
background-color: darken($bgColor, 10%); background-color: darken($bgColor, 10%);
box-shadow: inset 0px 1px 3px rgba(0,0,0,0.15); box-shadow: inset 0px 1px 3px rgba(0,0,0,0.15);
} }

View File

@ -4,7 +4,6 @@
border-width: $buttonBorderWidth; border-width: $buttonBorderWidth;
border-style: solid; border-style: solid;
padding: $buttonPadding; padding: $buttonPadding;
} }
.button-default { .button-default {