26 |
27 |
This is a circular flyout menu made with Sass and CSS3 transitions, transforms, and animations. Click the icon in the bottom-right corner to witness the magic. Get the source code for this demo here on GitHub.
28 |
29 |
30 |
31 |
32 |
37 |
38 |
71 |
72 |
73 |
77 |
78 |
79 |
80 |
81 |
89 |
90 |
91 |
92 |
93 |
--------------------------------------------------------------------------------
/js/dist/circleMenu.min.js:
--------------------------------------------------------------------------------
1 | !function(e){"use strict";e.cssCircleMenu=function(e){function s(){a.addEventListener("click",function(e){e.preventDefault(),t()})}function t(){a.classList.contains("is-active")?c():i()}function i(){n.classList.add("is-active"),a.classList.add("is-active"),o.classList.add("is-active")}function c(){n.classList.remove("is-active"),a.classList.remove("is-active"),o.classList.remove("is-active")}var n=document.querySelector(e),a=n?n.querySelector(".js-menu-toggle"):void 0,o=n?n.querySelector(".js-menu-mask"):void 0;if(!(n&&a&&o))throw new Error("Invalid elements, check the structure.");return s(),{openMenu:i,closeMenu:c}}}(window);
--------------------------------------------------------------------------------
/js/lib/carbonAd.js:
--------------------------------------------------------------------------------
1 | (function(){
2 | var carbonad_script = document.createElement("script");
3 | carbonad_script.type = 'text/javascript';
4 | carbonad_script.async = true;
5 | carbonad_script.id = "_carbonads_js";
6 | carbonad_script.src = "//cdn.carbonads.com/carbon.js?zoneid=1673&serve=C6AILKT&placement=callmenickcom";
7 | document.body.appendChild(carbonad_script);
8 |
9 | var ad;
10 |
11 | var interval = window.setInterval( function() {
12 | ad = document.getElementById("carbonads");
13 | if ( ad !== null ) {
14 | clearInterval(interval);
15 | adClose();
16 | }
17 | }, 100 );
18 |
19 | function adClose() {
20 | var close = document.createElement("a");
21 | close.className = "carbonad__close";
22 | close.innerHTML = "x close";
23 | close.setAttribute("href", "#");
24 | ad.appendChild(close);
25 |
26 | close.addEventListener( "click", function(e) {
27 | e.preventDefault();
28 | ad.parentNode.removeChild(ad);
29 | })
30 | }
31 |
32 | })();
--------------------------------------------------------------------------------
/js/lib/githubIcons.js:
--------------------------------------------------------------------------------
1 | (function(){
2 | var gitWatch = document.createElement("iframe");
3 | gitWatch.setAttribute( "src", "http://ghbtns.com/github-btn.html?user=callmenick&repo=CSS-Circle-Menu&type=watch&count=true" );
4 | gitWatch.setAttribute( "allowtransparency", "true" );
5 | gitWatch.setAttribute( "frameborder", "0" );
6 | gitWatch.setAttribute( "scrolling", "0" );
7 | gitWatch.style.width = "110px";
8 | gitWatch.style.height = "20px";
9 | document.getElementById("github-icons").appendChild(gitWatch);
10 |
11 | var gitFork = document.createElement("iframe");
12 | gitFork.setAttribute( "src", "http://ghbtns.com/github-btn.html?user=callmenick&repo=CSS-Circle-Menu&type=fork&count=true" );
13 | gitFork.setAttribute( "allowtransparency", "true" );
14 | gitFork.setAttribute( "frameborder", "0" );
15 | gitFork.setAttribute( "scrolling", "0" );
16 | gitFork.style.width = "95px";
17 | gitFork.style.height = "20px";
18 | document.getElementById("github-icons").appendChild(gitFork);
19 | })();
--------------------------------------------------------------------------------
/js/src/circleMenu.js:
--------------------------------------------------------------------------------
1 | (function(window) {
2 | 'use strict';
3 |
4 | window.cssCircleMenu = function(el) {
5 | var $menu = document.querySelector(el);
6 | var $menuToggle = $menu ? $menu.querySelector('.js-menu-toggle') : undefined;
7 | var $menuMask = $menu ? $menu.querySelector('.js-menu-mask') : undefined;
8 |
9 | if (!$menu || !$menuToggle || !$menuMask) {
10 | throw new Error('Invalid elements, check the structure.');
11 | } else {
12 | init();
13 | }
14 |
15 | return {
16 | openMenu: openMenu,
17 | closeMenu: closeMenu
18 | };
19 |
20 | function init() {
21 | $menuToggle.addEventListener('click', function(e) {
22 | e.preventDefault();
23 | toggleMenu();
24 | });
25 | }
26 |
27 | function toggleMenu() {
28 | $menuToggle.classList.contains('is-active')
29 | ? closeMenu()
30 | : openMenu();
31 | }
32 |
33 | function openMenu() {
34 | $menu.classList.add('is-active');
35 | $menuToggle.classList.add('is-active');
36 | $menuMask.classList.add('is-active');
37 | }
38 |
39 | function closeMenu() {
40 | $menu.classList.remove('is-active');
41 | $menuToggle.classList.remove('is-active');
42 | $menuMask.classList.remove('is-active');
43 | }
44 | };
45 | })(window);
46 |
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "css-circle-menu",
3 | "version": "2.0.0",
4 | "description": "My circular fly-out CSS navigation menu component, built with CSS3.",
5 | "main": "gulpfile.js",
6 | "dependencies": {},
7 | "devDependencies": {
8 | "gulp": "^3.9.1",
9 | "gulp-autoprefixer": "^3.1.0",
10 | "gulp-concat": "^2.6.0",
11 | "gulp-minify-css": "^1.2.4",
12 | "gulp-notify": "^2.2.0",
13 | "gulp-plumber": "^1.1.0",
14 | "gulp-rename": "^1.2.2",
15 | "gulp-sass": "^2.3.2",
16 | "gulp-uglify": "^1.5.4",
17 | "gulp-util": "^3.0.7",
18 | "node-notifier": "^4.6.0"
19 | },
20 | "repository": {
21 | "type": "git",
22 | "url": "git+https://github.com/callmenick/CSS-Circle-Menu.git"
23 | },
24 | "author": "Nick Salloum