A Pen by Joe Watkins on CodePen.
Created
February 17, 2014 19:46
-
-
Save joe-watkins/9057571 to your computer and use it in GitHub Desktop.
A Pen by Joe Watkins.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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>'); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@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