# novacancy.js novacancy.js is a text neon golden effect jQuery plugin. Now with a pure Vanilla JavaScript version! ## Demo Visit demo site ## jQuery Version ### Basic Usage #### Just use ```javascript $('#no').novacancy(); ``` #### or detail ```javascript $('#no').novacancy({ 'reblinkProbability': 0.1, 'blinkMin': 0.2, 'blinkMax': 0.6, 'loopMin': 8, 'loopMax': 10, 'color': '#ffffff', 'glow': ['0 0 80px #ffffff', '0 0 30px #008000', '0 0 6px #0000ff'], 'off': 1, 'blink': 1, 'classOn': 'on', 'classOff': 'off', 'element': 'data', 'autoOn': true }); ``` ### Control #### trigger blink on ```javascript $('#no').trigger('blinkOn'); ``` #### trigger blink off ```javascript $('#no').trigger('blinkOff'); ``` ## Vanilla JavaScript Version (No jQuery Required) Want to use this effect without jQuery? We've got you covered with a pure JavaScript version! ### Basic Usage #### Just use ```javascript initNovacancy('#no', {}); ``` #### or detail ```javascript initNovacancy('#no', { 'reblinkProbability': 0.1, 'blinkMin': 0.2, 'blinkMax': 0.6, 'loopMin': 8, 'loopMax': 10, 'color': '#ffffff', 'glow': ['0 0 80px #ffffff', '0 0 30px #008000', '0 0 6px #0000ff'], 'off': 1, 'blink': 1, 'classOn': 'on', 'classOff': 'off', 'element': 'span', // 'data' is not a valid interactive element, use 'span' instead 'autoOn': true }); ``` ### Control #### trigger blink on ```javascript document.getElementById('no').dispatchEvent(new CustomEvent('blinkOn')); ``` #### trigger blink off ```javascript document.getElementById('no').dispatchEvent(new CustomEvent('blinkOff')); ``` ### Additional Methods The vanilla version returns an array of Novacancy instances, allowing more control: ```javascript // Initialize and store instances const instances = initNovacancy('.neon-text', options); // Update options after initialization instances[0].setOptions({ 'color': 'GREEN', 'glow': ['0 0 80px GREEN', '0 0 30px LIME', '0 0 6px #AAFF00'] }); // Clean up resources when no longer needed instances[0].destroy(); ``` ## Parameters - reblinkProbability: probability of reblink(0 to 1), Number, optional, default: (1/3) - blinkMin: time(sec.) of minimum blink, Number, optional, default: 0.01 - blinkMax: time(sec.) of maximum blink, Number, optional, default: 0.5 - loopMin: time(sec.) of minimum trigger blink, Number, optional, default: 0.5 - loopMax: time(sec.) of maximum trigger blink, Number, optional, default: 2 - color: colors, String, optional default: 'ORANGE'. set null to disable. - glow: array of text-shadow colors, Array, optional, default: ['0 0 80px Orange', '0 0 30px Red', '0 0 6px Yellow']. set null to disable. - off: amount of off chars, Number, optional, default: 0 - blink: amount of blink chars, Number, optional, default: 0, (0 means all chars) - classOn: class name of on chars, String, optional default: 'on' - classOff: class name of off chars, String, optional default: 'off' - element: split content by element, default for jQuery version: data, default for Vanilla version: span - autoOn: blink on at start, Boolean, optional, default: true ### colors example: ```javascript Hexadecimal: '#ffffff' RGB: 'rgb(255,255,255)' RGBA: 'rgba(255,255,255,1)' Text: 'WHITE' ``` ## Demo Files - `demo.html` - Original jQuery version demo - `demo.vanilla.html` - Vanilla JavaScript version demo ## Files - `javascript/jquery.novacancy.js` - Original jQuery plugin - `javascript/jquery.novacancy.min.js` - Minified jQuery plugin - `novacancy.vanilla.js` - Vanilla JavaScript version (no jQuery required) ## License Copyright (c) 2018 Chuck Chang Licensed under the MIT license ## Special Thanks - Evil Reiko