health.js
1.0 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
/**
* Author: Kris Olszewski
* CodePen: https://codepen.io/KrisOlszewski/full/wBQBNX
*/
;(function($, window, document, undefined) {
'use strict';
var $html = $('html');
$html.on('click.ui.dropdown', '.js-dropdown', function(e) {
e.preventDefault();
$(this).toggleClass('is-open');
});
$html.on('click.ui.dropdown', '.js-dropdown [data-dropdown-value]', function(e) {
e.preventDefault();
var $item = $(this);
var $dropdown = $item.parents('.js-dropdown');
$dropdown.find('.js-dropdown__input').val($item.data('dropdown-value'));
$dropdown.find('.js-dropdown__current').text($item.text());
});
$html.on('click.ui.dropdown', function(e) {
var $target = $(e.target);
if (!$target.parents().hasClass('js-dropdown')) {
$('.js-dropdown').removeClass('is-open');
}
});
})(jQuery, window, document);
window.onload = function(){
var current = 0;
document.getElementById('target').onclick = function(){
current = (current+45)%360;
this.style.transform = 'rotate('+current+'deg)';
}
};