Skip to content

Instantly share code, notes, and snippets.

@joe-watkins
Created February 17, 2014 19:46
Show Gist options
  • Save joe-watkins/9057571 to your computer and use it in GitHub Desktop.
Save joe-watkins/9057571 to your computer and use it in GitHub Desktop.
A Pen by Joe Watkins.
var alert = $('p.message'),
msgPass = 'Your web browser supports Drag and Drop',
msgFail = 'Your web browser does not support Drag and Drop',
passClassName = 'pass',
failClassName = 'fail';
if(supportsDragAndDrop){
createMsg('pass',msgPass);
}
function supportsDragAndDrop(){
var div = document.createElement('div');
return ('draggable' in div) || ('ondragstart' in div && 'ondrop' in div);
}
function createMsg(className,msg){
$('body').prepend('<p class="'+className+'">'+msg+'</p>');
}
@import "compass";
body {
margin:15px;
font: normal 1em/1.3 'Helvetica Neue', Helvetica, Arial, sans-serif;
}
$pass: #DFF0D8;
$fail: #F2DEDE;
@mixin alert($color){
background:$color;
border:solid 2px darken($color,10%);
}
p {
padding:10px;
&.pass {
@include alert($pass);
}
&.fail {
@include alert($fail);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment