Windows 10 toggle button directive
How do I make an windows 10 toggle button directive?
Angular implementation of this great pen: http://codepen.io/kunukn/pen/Krqopm. What is a windows 10 toggle button directive? How do you make a windows 10 toggle button directive? This script and codes were developed by Robert Lowe on 23 July 2022, Saturday.
Windows 10 toggle button directive - Script Codes HTML Codes
<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>Windows 10 toggle button directive</title> <link href='https://fonts.googleapis.com/css?family=Open+Sans' rel='stylesheet' type='text/css'> <link rel='stylesheet prefetch' href='https://maxcdn.bootstrapcdn.com/font-awesome/4.4.0/css/font-awesome.min.css'> <link rel="stylesheet" href="css/style.css">
</head>
<body> <div class="pattern-color"></div>
<div ng-app="angularPageApp" ng-controller="angularPageAppCtrl" class="app-container"> <div class="material"> <toggle-btn value="toggleBtnValue" action="onToggleBtnChange"></toggle-btn> </div>
</div> <script src='https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.5.0-beta.1/angular.min.js'></script>
<script src='https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.5.0-beta.0/angular-sanitize.min.js'></script> <script src="js/index.js"></script>
</body>
</html>
Windows 10 toggle button directive - Script Codes CSS Codes
*,
*::before,
*::after { box-sizing: border-box;
}
body { font-family: 'Open Sans', sans-serif; margin: 0; padding: 0; background: url("http://subtlepatterns2015.subtlepatterns.netdna-cdn.com/patterns/shinecaro.png"); font-size: 66.5%;
}
body .pattern-color { position: absolute; top: 0; left: 0; width: 100%; height: 100%; z-index: 1; background-color: rgba(122, 224, 180, 0.5);
}
.app-container { display: flex; flex-flow: column nowrap; justify-content: center; align-items: center; height: 100vh;
}
.material { background-color: white; padding: 5em; box-shadow: 0 14px 28px rgba(0, 0, 0, 0.25), 0 10px 10px rgba(0, 0, 0, 0.22); z-index: 10;
}
.disapper-from-screen, .toggle-btn .toggle input { border: 0; clip: rect(0 0 0 0); height: 1px; margin: -1px; overflow: hidden; padding: 0; position: absolute; width: 1px;
}
.toggle-btn { position: relative;
}
.toggle-btn .toggle { display: table; -webkit-tap-highlight-color: transparent; margin-bottom: 1rem; margin: 0; padding: 0;
}
.toggle-btn .toggle input:focus + div { text-decoration: underline;
}
.toggle-btn .toggle > div { cursor: pointer; border-radius: 2rem; width: 5rem; height: 2rem; background: white; border: 2px solid #9EE493; user-select: none; position: relative; transition: 200ms ease-out; font-size: 0;
}
.toggle-btn .toggle > div:hover { box-shadow: 0 0 6px #79da6a;
}
.toggle-btn .toggle > div:before { will-change: translate; display: block; position: absolute; top: calc(50% - .5rem); left: .5rem; content: ''; width: 1rem; height: 1rem; background: #9EE493; border-radius: 50%; transition: 200ms;
}
.toggle-btn .toggle > div:after { font-size: 1rem; font-weight: bold; position: absolute; right: -50%; top: 50%; transform: translateY(-50%); content: attr(data-off); pointer-events: none; color: #67d556;
}
.toggle-btn .toggle input:checked + div { background: #9EE493; border-color: #9EE493;
}
.toggle-btn .toggle input:checked + div:before { color: #9EE493; transform: translateX(280%); transform: translateX(calc(2.5*100% + 4px)); background: white;
}
.toggle-btn .toggle input:checked + div:after { content: attr(data-on);
}
Windows 10 toggle button directive - Script Codes JS Codes
var ToggleBtnModule = angular.module('toggleBtnModule', ['ngSanitize']);
ToggleBtnModule.directive('toggleBtn', function() { return { restrict: 'E', replace: true, scope: { value: '=', action: '=' }, controller: function($scope) {}, template: [ '<div class="toggle-btn">', '<label class="toggle">', '<input ng-model="value" ng-checked="value" type="checkbox" ng-click="action(value)"/>', '<div data-off="Off" data-on="On"></div>', '</label>', '</div>' ].join(''), link: function(scope, element, attrs) {} };
});
// Usage
var PageApp = angular.module('angularPageApp', ['ngSanitize', 'toggleBtnModule']);
PageApp.controller('angularPageAppCtrl', function($scope) { $scope.toggleBtnValue = false; $scope.onToggleBtnChange = function(newVal) { console.log('new toggle value: ', $scope.toggleBtnValue); };
});
Developer | Robert Lowe |
Username | rlo206 |
Uploaded | July 23, 2022 |
Rating | 4 |
Size | 4,256 Kb |
Views | 60,720 |
Find the perfect freelance services for your business! Fiverr's mission is to change how the world works together. Fiverr connects businesses with freelancers offering digital services in 500+ categories. Find Developer!
Name | Size |
A Pen by Robert Lowe | 4,312 Kb |
CSS Color Wheel Loaders | 5,381 Kb |
Simple changelog display with AngularJS and Flexbox | 7,502 Kb |
Editable Table Concept | 7,026 Kb |
Crazy Tables | 3,065 Kb |
Semantic Element Document Outline | 3,153 Kb |
Animated slider in pure angular | 5,111 Kb |
Whirlpool Spinner with 4 sizes | 3,473 Kb |
Customizable ripples with angular | 4,825 Kb |
Fly-Through-Loader | 2,936 Kb |
Jasper is the AI Content Generator that helps you and your team break through creative blocks to create amazing, original content 10X faster. Discover all the ways the Jasper AI Content Platform can help streamline your creative workflows. Start For Free!
Name | Username | Size |
Zip Button test | Lje7462 | 1,932 Kb |
Loading animation | Codeams | 2,408 Kb |
React Markdown Previewer | C0d0er | 3,190 Kb |
CSS Letter animations | Sladix | 2,116 Kb |
Twinkling Stars | Ripley6811 | 2,750 Kb |
Colorful Sliders | Chanrith | 1,246 Kb |
Test | Dviate | 2,668 Kb |
Ionic Infinite outside ion-content with ion-pane | Felquis | 3,117 Kb |
Flat UI - Checkbox FIX | ARS | 2,663 Kb |
Sass Radar | Jlong | 6,887 Kb |
Surf anonymously, prevent hackers from acquiring your IP address, send anonymous email, and encrypt your Internet connection. High speed, ultra secure, and easy to use. Instant setup. Hide Your IP Now!