├── JulieAlert.gif ├── LICENSE ├── README.md ├── assets ├── JulieAlert.css ├── JulieAlert.js ├── JulieAlert.min.css └── JulieAlert.min.js ├── image.png ├── index.html ├── julie.css └── julie.js /JulieAlert.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lichin-lin/Juliealert/f992afd81663c61a0edee6562d619d9477068756/JulieAlert.gif -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (C) 2016 lichin-lin 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 4 | 5 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 6 | 7 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # JulieAlert 2 | 3 | JulieAlert let you display Javascript alert function with beautiful custom style. 4 |
5 | All you need is ```julie```:grin::grin::grin:. 6 |
7 | ![JulieAlert.gif](https://raw.githubusercontent.com/lichin-lin/Juliealert/master/JulieAlert.gif) 8 | 9 | 10 | 11 | ## Setup 12 | 13 | download the package and reference the JavaScript and CSS files manually: 14 | ```html 15 | 16 | 17 | ``` 18 | 19 | ##Example 20 | 21 | using jquery to control ```julie``` function: 22 | 23 | 1.Basic style: 24 | ```javascript 25 | $('button').click(function(){ 26 | Julie({ 27 | title: "Julie!", 28 | text: "Nice to meet you!", 29 | confirmText:"got it", 30 | errorText:"", 31 | Pop:false, 32 | }); 33 | }); 34 | ``` 35 | ___ 36 |
37 | 38 | 39 | 2.With different animation style: 40 | ```javascript 41 | $('button').click(function(){ 42 | Julie({ 43 | title: "Pop!", 44 | text: "animation feature,Pop-Style", 45 | confirmText: "Know!", 46 | errorText:"", 47 | Pop: true 48 | }); 49 | }); 50 | ``` 51 | ___ 52 |
53 | 54 | 55 | 56 | 3.Even \ tag in button: 57 | ```javascript 58 | $("button").click(function(){ 59 | Julie({ 60 | title: "Cool!Right?", 61 | text: "click the button below!", 62 | errorText: JulieUrl("really?","https://github.com/lichin-lin/Juliealert"), 63 | Pop:false 64 | }); 65 | }); 66 | ``` 67 | ___ 68 |
69 | 70 | 71 | 4.Customized your input in HTML style: 72 | ```javascript 73 | $("button").click(function(){ 74 | Julie({ 75 | title: "Wait!there's more", 76 | text: "

last demo style!
IT IS FANCY
HTML element

", 77 | confirmText: "bro!", 78 | errorText:"I will miss you!!", 79 | Pop:false 80 | }); 81 | }); 82 | ``` 83 | ___ 84 | 85 | -------------------------------------------------------------------------------- /assets/JulieAlert.css: -------------------------------------------------------------------------------- 1 | .Julie-board { 2 | overflow: hidden; 3 | transition: all 0.2s ease; 4 | display: none; 5 | position: fixed; 6 | opacity: 0; 7 | top: 0; 8 | right: 0; 9 | bottom: 0; 10 | left: 0; 11 | z-index: 1000; 12 | background-color: rgba(0,0,0,0.25); 13 | } 14 | .Julie-Alert { 15 | color: #6b6b6b; 16 | opacity: 0; 17 | display: none; 18 | flex-direction: column; 19 | align-items: center; 20 | position: fixed; 21 | width: 450px; 22 | min-height: 200px; 23 | top: 50%; 24 | left: calc(50% - 225px); 25 | background-color: #fff; 26 | border: 1px solid #fff; 27 | border-radius: 5px; 28 | z-index: 1000; 29 | transition: all 0.7s ease; 30 | } 31 | .Julie-Alert h2 { 32 | font-family: Bad script; 33 | margin: 20px 0 5px 0; 34 | } 35 | .Julie-Alert .Alert-content { 36 | display: block; 37 | margin: 0; 38 | padding: 20px 20px 0px 20px; 39 | } 40 | .Julie-Alert .Alert-btn-container { 41 | display: block; 42 | position: relative; 43 | margin: 0 auto; 44 | padding: 30px 0 10px 0; 45 | } 46 | .Julie-Alert .Alert-btn-container button { 47 | display: inline-block; 48 | margin: 10px 10px; 49 | padding: 10px 30px 10px 30px; 50 | border: 2px solid #6b6b6b; 51 | border-radius: 5px; 52 | color: #fff; 53 | font-size: 18px; 54 | font-weight: 400; 55 | outline: none; 56 | cursor: pointer; 57 | transition: all 0.25s ease; 58 | } 59 | .Julie-Alert .Alert-btn-container button a { 60 | text-decoration: none; 61 | } 62 | .Julie-Alert .Alert-btn-container button:hover { 63 | transition: all 0.5s ease; 64 | border-color: #fff; 65 | color: #fff; 66 | } 67 | .Julie-Alert .Alert-btn-container button:hover > a { 68 | color: #fff; 69 | } 70 | .Julie-Alert .Alert-btn-container .confirm { 71 | color: #91c8ff; 72 | border-color: #91c8ff; 73 | background-color: transparent; 74 | } 75 | .Julie-Alert .Alert-btn-container .confirm a { 76 | color: #91c8ff; 77 | } 78 | .Julie-Alert .Alert-btn-container .confirm:hover { 79 | background-color: #91c8ff; 80 | } 81 | .Julie-Alert .Alert-btn-container .error { 82 | color: #fc9f8d; 83 | border-color: #fc9f8d; 84 | background-color: transparent; 85 | } 86 | .Julie-Alert .Alert-btn-container .error a { 87 | color: #fc9f8d; 88 | } 89 | .Julie-Alert .Alert-btn-container .error:hover { 90 | background-color: #fc9f8d; 91 | } 92 | .showJulieAlertBoard { 93 | -webkit-animation: showAlertBoard 0.3s; 94 | animation: showAlertBoard 0.3s; 95 | opacity: 0.7; 96 | display: block; 97 | } 98 | .showJulieAlert { 99 | -webkit-animation: showAlert 0.3s; 100 | animation: showAlert 0.3s; 101 | } 102 | .showJulieAlertPop { 103 | -webkit-animation: showAlertPop 0.25s; 104 | animation: showAlertPop 0.25s; 105 | animation-delay: 0.125s; 106 | } 107 | .hideJulieAlert { 108 | -webkit-animation: hideAlert 0.3s; 109 | animation: hideAlert 0.3s; 110 | } 111 | @media (max-width: 768px) { 112 | .Julie { 113 | border: none; 114 | } 115 | .Julie .Julie-title { 116 | width: 150px; 117 | height: 70px; 118 | } 119 | .Julie .Julie-title h1 { 120 | font-size: 30px; 121 | } 122 | .Julie .Julie-content { 123 | margin: 30px 0; 124 | width: 100%; 125 | } 126 | .Julie .Julie-content .Julie-extra { 127 | font-size: 0.85em; 128 | } 129 | .Julie .Julie-content .Julie-btn { 130 | height: 150px; 131 | width: 80%; 132 | } 133 | .Julie-Alert { 134 | min-width: 250px; 135 | min-height: 200px; 136 | } 137 | } 138 | @-moz-keyframes showAlertBoard { 139 | 0% { 140 | display: none; 141 | opacity: 0; 142 | } 143 | 1% { 144 | transform: scale(0.1); 145 | -webkit-transform: scale(0.1); 146 | display: block; 147 | opacity: 0; 148 | border-radius: 50%; 149 | } 150 | 100% { 151 | transform: scale(1); 152 | -webkit-transform: scale(1); 153 | opacity: 0.7; 154 | border-radius: 1px; 155 | } 156 | } 157 | @-webkit-keyframes showAlertBoard { 158 | 0% { 159 | display: none; 160 | opacity: 0; 161 | } 162 | 1% { 163 | transform: scale(0.1); 164 | -webkit-transform: scale(0.1); 165 | display: block; 166 | opacity: 0; 167 | border-radius: 50%; 168 | } 169 | 100% { 170 | transform: scale(1); 171 | -webkit-transform: scale(1); 172 | opacity: 0.7; 173 | border-radius: 1px; 174 | } 175 | } 176 | @-o-keyframes showAlertBoard { 177 | 0% { 178 | display: none; 179 | opacity: 0; 180 | } 181 | 1% { 182 | transform: scale(0.1); 183 | -webkit-transform: scale(0.1); 184 | display: block; 185 | opacity: 0; 186 | border-radius: 50%; 187 | } 188 | 100% { 189 | transform: scale(1); 190 | -webkit-transform: scale(1); 191 | opacity: 0.7; 192 | border-radius: 1px; 193 | } 194 | } 195 | @keyframes showAlertBoard { 196 | 0% { 197 | display: none; 198 | opacity: 0; 199 | } 200 | 1% { 201 | transform: scale(0.1); 202 | -webkit-transform: scale(0.1); 203 | display: block; 204 | opacity: 0; 205 | border-radius: 50%; 206 | } 207 | 100% { 208 | transform: scale(1); 209 | -webkit-transform: scale(1); 210 | opacity: 0.7; 211 | border-radius: 1px; 212 | } 213 | } 214 | @-moz-keyframes showAlert { 215 | 0% { 216 | transform: scale(0.8); 217 | -webkit-transform: scale(0.8); 218 | opacity: 0.3; 219 | } 220 | 70% { 221 | opacity: 1; 222 | } 223 | 100% { 224 | transform: scale(1); 225 | -webkit-transform: scale(1); 226 | opacity: 1; 227 | } 228 | } 229 | @-webkit-keyframes showAlert { 230 | 0% { 231 | transform: scale(0.8); 232 | -webkit-transform: scale(0.8); 233 | opacity: 0.3; 234 | } 235 | 70% { 236 | opacity: 1; 237 | } 238 | 100% { 239 | transform: scale(1); 240 | -webkit-transform: scale(1); 241 | opacity: 1; 242 | } 243 | } 244 | @-o-keyframes showAlert { 245 | 0% { 246 | transform: scale(0.8); 247 | -webkit-transform: scale(0.8); 248 | opacity: 0.3; 249 | } 250 | 70% { 251 | opacity: 1; 252 | } 253 | 100% { 254 | transform: scale(1); 255 | -webkit-transform: scale(1); 256 | opacity: 1; 257 | } 258 | } 259 | @keyframes showAlert { 260 | 0% { 261 | transform: scale(0.8); 262 | -webkit-transform: scale(0.8); 263 | opacity: 0.3; 264 | } 265 | 70% { 266 | opacity: 1; 267 | } 268 | 100% { 269 | transform: scale(1); 270 | -webkit-transform: scale(1); 271 | opacity: 1; 272 | } 273 | } 274 | @-moz-keyframes showAlertPop { 275 | 0% { 276 | transform: scale(0.7); 277 | -webkit-transform: scale(0.7); 278 | opacity: 0; 279 | } 280 | 1% { 281 | opacity: 1; 282 | } 283 | 50% { 284 | transform: scale(1.03); 285 | -webkit-transform: scale(1.03); 286 | opacity: 1; 287 | } 288 | 70% { 289 | transform: scale(0.9); 290 | -webkit-transform: scale(0.9); 291 | opacity: 1; 292 | } 293 | 100% { 294 | transform: scale(1); 295 | -webkit-transform: scale(1); 296 | opacity: 1; 297 | } 298 | } 299 | @-webkit-keyframes showAlertPop { 300 | 0% { 301 | transform: scale(0.7); 302 | -webkit-transform: scale(0.7); 303 | opacity: 0; 304 | } 305 | 1% { 306 | opacity: 1; 307 | } 308 | 50% { 309 | transform: scale(1.03); 310 | -webkit-transform: scale(1.03); 311 | opacity: 1; 312 | } 313 | 70% { 314 | transform: scale(0.9); 315 | -webkit-transform: scale(0.9); 316 | opacity: 1; 317 | } 318 | 100% { 319 | transform: scale(1); 320 | -webkit-transform: scale(1); 321 | opacity: 1; 322 | } 323 | } 324 | @-o-keyframes showAlertPop { 325 | 0% { 326 | transform: scale(0.7); 327 | -webkit-transform: scale(0.7); 328 | opacity: 0; 329 | } 330 | 1% { 331 | opacity: 1; 332 | } 333 | 50% { 334 | transform: scale(1.03); 335 | -webkit-transform: scale(1.03); 336 | opacity: 1; 337 | } 338 | 70% { 339 | transform: scale(0.9); 340 | -webkit-transform: scale(0.9); 341 | opacity: 1; 342 | } 343 | 100% { 344 | transform: scale(1); 345 | -webkit-transform: scale(1); 346 | opacity: 1; 347 | } 348 | } 349 | @keyframes showAlertPop { 350 | 0% { 351 | transform: scale(0.7); 352 | -webkit-transform: scale(0.7); 353 | opacity: 0; 354 | } 355 | 1% { 356 | opacity: 1; 357 | } 358 | 50% { 359 | transform: scale(1.03); 360 | -webkit-transform: scale(1.03); 361 | opacity: 1; 362 | } 363 | 70% { 364 | transform: scale(0.9); 365 | -webkit-transform: scale(0.9); 366 | opacity: 1; 367 | } 368 | 100% { 369 | transform: scale(1); 370 | -webkit-transform: scale(1); 371 | opacity: 1; 372 | } 373 | } 374 | @-moz-keyframes hideAlert { 375 | 0% { 376 | transform: scale(1); 377 | -webkit-transform: scale(1); 378 | opacity: 1; 379 | } 380 | 100% { 381 | transform: scale(0.4); 382 | -webkit-transform: scale(0.4); 383 | opacity: 0; 384 | display: none; 385 | } 386 | } 387 | @-webkit-keyframes hideAlert { 388 | 0% { 389 | transform: scale(1); 390 | -webkit-transform: scale(1); 391 | opacity: 1; 392 | } 393 | 100% { 394 | transform: scale(0.4); 395 | -webkit-transform: scale(0.4); 396 | opacity: 0; 397 | display: none; 398 | } 399 | } 400 | @-o-keyframes hideAlert { 401 | 0% { 402 | transform: scale(1); 403 | -webkit-transform: scale(1); 404 | opacity: 1; 405 | } 406 | 100% { 407 | transform: scale(0.4); 408 | -webkit-transform: scale(0.4); 409 | opacity: 0; 410 | display: none; 411 | } 412 | } 413 | @keyframes hideAlert { 414 | 0% { 415 | transform: scale(1); 416 | -webkit-transform: scale(1); 417 | opacity: 1; 418 | } 419 | 100% { 420 | transform: scale(0.4); 421 | -webkit-transform: scale(0.4); 422 | opacity: 0; 423 | display: none; 424 | } 425 | } -------------------------------------------------------------------------------- /assets/JulieAlert.js: -------------------------------------------------------------------------------- 1 | function Julie(content){ 2 | if(isEmpty(content.errorText)){ 3 | $('.Julie-Alert .error').css("display","none"); 4 | }else{ 5 | $('.Julie-Alert .error').css("display","inline-block"); 6 | } 7 | if(isEmpty(content.confirmText)){ 8 | $('.Julie-Alert .confirm').css("display","none"); 9 | }else{ 10 | $('.Julie-Alert .confirm').css("display","inline-block"); 11 | } 12 | console.log(content.confirmText); 13 | $('.Julie-Alert h2').text(content.title); 14 | $('.Julie-Alert .Alert-content').html(content.text); 15 | $('.Julie-Alert .confirm').html(content.confirmText); 16 | $('.Julie-Alert .error').html(content.errorText); 17 | 18 | $('body').addClass("stop-scroll"); 19 | 20 | $('.Julie-board').css({ 21 | width: FindLarge()+200, 22 | height: FindLarge()+200, 23 | top: topOffset()-100 + "px", 24 | left: leftOffset()-100 + "px", 25 | }).addClass('showJulieAlertBoard'); 26 | 27 | $('.Julie-Alert') 28 | .removeClass('hideJulieAlert') 29 | .css({ 30 | display:"flex", 31 | opacity:1, 32 | "margin-top": -$('.Julie-Alert').height()/2 33 | }) 34 | if(!content.Pop){ 35 | $('.Julie-Alert').addClass('showJulieAlert'); 36 | }else{ 37 | $('.Julie-Alert').addClass('showJulieAlertPop'); 38 | } 39 | 40 | 41 | 42 | $('.Julie-Alert button').click(function(){ 43 | $('body').removeClass("stop-scroll"); 44 | $('.Julie-board').removeClass('showJulieAlertBoard'); 45 | $('.Julie-Alert').removeClass('showJulieAlert'); 46 | $('.Julie-Alert').removeClass('showJulieAlertPop'); 47 | $('.Julie-Alert') 48 | .addClass('hideJulieAlert') 49 | .css({ 50 | display:"none", 51 | opacity:0 52 | }); 53 | }); 54 | 55 | } 56 | 57 | function JulieUrl(name,url){ 58 | return " " + name + " "; 59 | } 60 | function isEmpty(str) { 61 | return typeof str == 'string' && !str.trim() || typeof str == 'undefined' || str === null; 62 | } 63 | function FindLarge(){ 64 | return $(window).width() > $(window).height() ? $(window).width() : $(window).height(); 65 | } 66 | function topOffset(){ 67 | return $(window).width() > $(window).height() ? $(window).height()/2 - $(window).width()/2 : 0; 68 | } 69 | function leftOffset(){ 70 | return $(window).width() > $(window).height() ? 0 : $(window).width()/2 - $(window).height()/2; 71 | } -------------------------------------------------------------------------------- /assets/JulieAlert.min.css: -------------------------------------------------------------------------------- 1 | .Julie-board{overflow:hidden;transition:all 0.2s ease;display:none;position:fixed;opacity:0;top:0;right:0;bottom:0;left:0;z-index:1000;background-color:rgba(0,0,0,.25)}.Julie-Alert{color:#6b6b6b;opacity:0;display:none;flex-direction:column;align-items:center;position:fixed;width:450px;min-height:200px;top:50%;left:calc(50% - 225px);background-color:#fff;border:1px solid #fff;border-radius:5px;z-index:1000;transition:all 0.7s ease}.Julie-Alert h2{font-family:Bad script;margin:20px 0 5px 0}.Julie-Alert .Alert-content{display:block;margin:0;padding:20px 20px 0 20px}.Julie-Alert .Alert-btn-container{display:block;position:relative;margin:0 auto;padding:30px 0 10px 0}.Julie-Alert .Alert-btn-container button{display:inline-block;margin:10px 10px;padding:10px 30px 10px 30px;border:2px solid #6b6b6b;border-radius:5px;color:#fff;font-size:18px;font-weight:400;outline:none;cursor:pointer;transition:all 0.25s ease}.Julie-Alert .Alert-btn-container button a{text-decoration:none}.Julie-Alert .Alert-btn-container button:hover{transition:all 0.5s ease;border-color:#fff;color:#fff}.Julie-Alert .Alert-btn-container button:hover>a{color:#fff}.Julie-Alert .Alert-btn-container .confirm{color:#91c8ff;border-color:#91c8ff;background-color:transparent}.Julie-Alert .Alert-btn-container .confirm a{color:#91c8ff}.Julie-Alert .Alert-btn-container .confirm:hover{background-color:#91c8ff}.Julie-Alert .Alert-btn-container .error{color:#fc9f8d;border-color:#fc9f8d;background-color:transparent}.Julie-Alert .Alert-btn-container .error a{color:#fc9f8d}.Julie-Alert .Alert-btn-container .error:hover{background-color:#fc9f8d}.showJulieAlertBoard{-webkit-animation:showAlertBoard 0.3s;animation:showAlertBoard 0.3s;opacity:.7;display:block}.showJulieAlert{-webkit-animation:showAlert 0.3s;animation:showAlert 0.3s}.showJulieAlertPop{-webkit-animation:showAlertPop 0.25s;animation:showAlertPop 0.25s;animation-delay:0.125s}.hideJulieAlert{-webkit-animation:hideAlert 0.3s;animation:hideAlert 0.3s}@media (max-width:768px){.Julie{border:none}.Julie .Julie-title{width:150px;height:70px}.Julie .Julie-title h1{font-size:30px}.Julie .Julie-content{margin:30px 0;width:100%}.Julie .Julie-content .Julie-extra{font-size:.85em}.Julie .Julie-content .Julie-btn{height:150px;width:80%}.Julie-Alert{min-width:250px;min-height:200px}}@-moz-keyframes showAlertBoard{0%{display:none;opacity:0}1%{transform:scale(.1);-webkit-transform:scale(.1);display:block;opacity:0;border-radius:50%}100%{transform:scale(1);-webkit-transform:scale(1);opacity:.7;border-radius:1px}}@-webkit-keyframes showAlertBoard{0%{display:none;opacity:0}1%{transform:scale(.1);-webkit-transform:scale(.1);display:block;opacity:0;border-radius:50%}100%{transform:scale(1);-webkit-transform:scale(1);opacity:.7;border-radius:1px}}@-o-keyframes showAlertBoard{0%{display:none;opacity:0}1%{transform:scale(.1);-webkit-transform:scale(.1);display:block;opacity:0;border-radius:50%}100%{transform:scale(1);-webkit-transform:scale(1);opacity:.7;border-radius:1px}}@keyframes showAlertBoard{0%{display:none;opacity:0}1%{transform:scale(.1);-webkit-transform:scale(.1);display:block;opacity:0;border-radius:50%}100%{transform:scale(1);-webkit-transform:scale(1);opacity:.7;border-radius:1px}}@-moz-keyframes showAlert{0%{transform:scale(.8);-webkit-transform:scale(.8);opacity:.3}70%{opacity:1}100%{transform:scale(1);-webkit-transform:scale(1);opacity:1}}@-webkit-keyframes showAlert{0%{transform:scale(.8);-webkit-transform:scale(.8);opacity:.3}70%{opacity:1}100%{transform:scale(1);-webkit-transform:scale(1);opacity:1}}@-o-keyframes showAlert{0%{transform:scale(.8);-webkit-transform:scale(.8);opacity:.3}70%{opacity:1}100%{transform:scale(1);-webkit-transform:scale(1);opacity:1}}@keyframes showAlert{0%{transform:scale(.8);-webkit-transform:scale(.8);opacity:.3}70%{opacity:1}100%{transform:scale(1);-webkit-transform:scale(1);opacity:1}}@-moz-keyframes showAlertPop{0%{transform:scale(.7);-webkit-transform:scale(.7);opacity:0}1%{opacity:1}50%{transform:scale(1.03);-webkit-transform:scale(1.03);opacity:1}70%{transform:scale(.9);-webkit-transform:scale(.9);opacity:1}100%{transform:scale(1);-webkit-transform:scale(1);opacity:1}}@-webkit-keyframes showAlertPop{0%{transform:scale(.7);-webkit-transform:scale(.7);opacity:0}1%{opacity:1}50%{transform:scale(1.03);-webkit-transform:scale(1.03);opacity:1}70%{transform:scale(.9);-webkit-transform:scale(.9);opacity:1}100%{transform:scale(1);-webkit-transform:scale(1);opacity:1}}@-o-keyframes showAlertPop{0%{transform:scale(.7);-webkit-transform:scale(.7);opacity:0}1%{opacity:1}50%{transform:scale(1.03);-webkit-transform:scale(1.03);opacity:1}70%{transform:scale(.9);-webkit-transform:scale(.9);opacity:1}100%{transform:scale(1);-webkit-transform:scale(1);opacity:1}}@keyframes showAlertPop{0%{transform:scale(.7);-webkit-transform:scale(.7);opacity:0}1%{opacity:1}50%{transform:scale(1.03);-webkit-transform:scale(1.03);opacity:1}70%{transform:scale(.9);-webkit-transform:scale(.9);opacity:1}100%{transform:scale(1);-webkit-transform:scale(1);opacity:1}}@-moz-keyframes hideAlert{0%{transform:scale(1);-webkit-transform:scale(1);opacity:1}100%{transform:scale(.4);-webkit-transform:scale(.4);opacity:0;display:none}}@-webkit-keyframes hideAlert{0%{transform:scale(1);-webkit-transform:scale(1);opacity:1}100%{transform:scale(.4);-webkit-transform:scale(.4);opacity:0;display:none}}@-o-keyframes hideAlert{0%{transform:scale(1);-webkit-transform:scale(1);opacity:1}100%{transform:scale(.4);-webkit-transform:scale(.4);opacity:0;display:none}}@keyframes hideAlert{0%{transform:scale(1);-webkit-transform:scale(1);opacity:1}100%{transform:scale(.4);-webkit-transform:scale(.4);opacity:0;display:none}} -------------------------------------------------------------------------------- /assets/JulieAlert.min.js: -------------------------------------------------------------------------------- 1 | function Julie(content){if(isEmpty(content.errorText)){$('.Julie-Alert .error').css("display","none")}else{$('.Julie-Alert .error').css("display","inline-block")} 2 | if(isEmpty(content.confirmText)){$('.Julie-Alert .confirm').css("display","none")}else{$('.Julie-Alert .confirm').css("display","inline-block")} 3 | console.log(content.confirmText);$('.Julie-Alert h2').text(content.title);$('.Julie-Alert .Alert-content').html(content.text);$('.Julie-Alert .confirm').html(content.confirmText);$('.Julie-Alert .error').html(content.errorText);$('body').addClass("stop-scroll");$('.Julie-board').css({width:FindLarge()+200,height:FindLarge()+200,top:topOffset()-100+"px",left:leftOffset()-100+"px",}).addClass('showJulieAlertBoard');$('.Julie-Alert').removeClass('hideJulieAlert').css({display:"flex",opacity:1,"margin-top":-$('.Julie-Alert').height()/2}) 4 | if(!content.Pop){$('.Julie-Alert').addClass('showJulieAlert')}else{$('.Julie-Alert').addClass('showJulieAlertPop')} 5 | $('.Julie-Alert button').click(function(){$('body').removeClass("stop-scroll");$('.Julie-board').removeClass('showJulieAlertBoard');$('.Julie-Alert').removeClass('showJulieAlert');$('.Julie-Alert').removeClass('showJulieAlertPop');$('.Julie-Alert').addClass('hideJulieAlert').css({display:"none",opacity:0})})} 6 | function JulieUrl(name,url){return " "+name+" "} 7 | function isEmpty(str){return typeof str=='string'&&!str.trim()||typeof str=='undefined'||str===null} 8 | function FindLarge(){return $(window).width()>$(window).height()?$(window).width():$(window).height()} 9 | function topOffset(){return $(window).width()>$(window).height()?$(window).height()/2-$(window).width()/2:0} 10 | function leftOffset(){return $(window).width()>$(window).height()?0:$(window).width()/2-$(window).height()/2} -------------------------------------------------------------------------------- /image.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lichin-lin/Juliealert/f992afd81663c61a0edee6562d619d9477068756/image.png -------------------------------------------------------------------------------- /index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | JulieAlert 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 29 | 30 | 31 | 32 |
33 |
34 |

JulieAlert

35 |
36 |
37 |
38 |

Feel free to fork JulieAlert on GitHub if you like it!

39 |
40 |
41 | Basic-Style for JulieAlert 42 |
43 |
44 |
45 | with great animation! 46 |
47 |
48 |
49 | Also, JulieAlert for error info 50 |
51 |
52 |
53 | More! HTML for JulieAlert 54 |
55 |
56 |
57 |
58 |
59 |
60 |

title

61 |
yo! trying to alert
62 |
63 | 64 | 65 |
66 |
67 | 68 | 69 | 70 | 71 | -------------------------------------------------------------------------------- /julie.css: -------------------------------------------------------------------------------- 1 | @import url("https://fonts.googleapis.com/css?family=Raleway"); 2 | body { 3 | padding: 0; 4 | margin: 0; 5 | font-family: Lato; 6 | background: linear-gradient(to top left, #f5ebeb 0%, #f8d5c3 25%, #e9c1c1 50%, #e9b0c1 75%); 7 | } 8 | body.stop-scroll { 9 | overflow: hidden; 10 | } 11 | button { 12 | font-family: Lato; 13 | } 14 | .Julie { 15 | display: -moz-flex; 16 | display: -webkit-flex; 17 | display: flex; 18 | flex-direction: column; 19 | align-items: center; 20 | } 21 | .Julie .Julie-title { 22 | margin-top: 10px; 23 | width: 250px; 24 | height: 100px; 25 | color: #6b6b6b; 26 | border-bottom: 2px dotted #6b6b6b; 27 | border-width: 4px; 28 | text-align: center; 29 | } 30 | .Julie .Julie-title h1 { 31 | font-family: Bad script; 32 | margin-top: 20px; 33 | padding-bottom: -10px; 34 | font-size: 55px; 35 | font-weight: 200; 36 | } 37 | .Julie .Julie-extra { 38 | color: #6b6b6b; 39 | font-family: Bad script; 40 | margin-top:-20px; 41 | padding-left: 20px; 42 | padding-right: 20px; 43 | } 44 | .Julie .Julie-extra strong a{ 45 | color: #000; 46 | cursor: pointer; 47 | transition: all 0.4s ease; 48 | text-decoration: none; 49 | } 50 | .Julie .Julie-extra strong a:hover { 51 | color: #fff; 52 | transition: all 0.4s ease; 53 | } 54 | .Julie .Julie-content { 55 | margin: 30px 0; 56 | width: 75%; 57 | height: auto; 58 | display: -moz-flex; 59 | display: -webkit-flex; 60 | display: flex; 61 | flex-direction: column; 62 | align-items: center; 63 | } 64 | .Julie .Julie-content .Julie-btn { 65 | display: -moz-flex; 66 | display: -webkit-flex; 67 | display: flex; 68 | flex-direction: column; 69 | align-items: center; 70 | margin-top: 30px; 71 | height: 150px; 72 | width: 50%; 73 | border-radius: 5px; 74 | } 75 | .Julie .Julie-content .Julie-btn span { 76 | font-family: Lato; 77 | color: #6b6b6b; 78 | } 79 | .Julie .Julie-content .Julie-btn button { 80 | margin: 10px 0; 81 | padding: 15px 30px 15px 30px; 82 | border: 2px solid #6b6b6b; 83 | border-radius: 5px; 84 | color: #6b6b6b; 85 | background-color: transparent; 86 | font-size: 15px; 87 | font-weight: 400; 88 | outline: none; 89 | cursor: pointer; 90 | transition: all 0.3s ease; 91 | } 92 | .Julie .Julie-content .Julie-btn button:hover { 93 | color: #fff; 94 | background-color: #6b6b6b; 95 | transition: all 0.25s ease; 96 | } 97 | .Julie .Julie-content .Julie-btn .blockquote { 98 | position: relative; 99 | width: 20px; 100 | height: 3px; 101 | background-color: #a1b585; 102 | margin-top: 30px; 103 | } 104 | .Julie .Julie-content .Julie-btn .blockquote::before, 105 | .Julie .Julie-content .Julie-btn .blockquote::after { 106 | content: ""; 107 | position: absolute; 108 | background-color: #a1b585; 109 | width: 3px; 110 | height: 20px; 111 | top: -9px; 112 | left: calc(50% - 1.5px); 113 | transform: rotate(45deg); 114 | } 115 | .Julie .Julie-content .Julie-btn .blockquote::after { 116 | transform: rotate(-45deg); 117 | } 118 | .Julie-board { 119 | overflow: hidden; 120 | transition: all 0.2s ease; 121 | display: none; 122 | position: fixed; 123 | opacity: 0; 124 | top: 0; 125 | right: 0; 126 | bottom: 0; 127 | left: 0; 128 | z-index: 1000; 129 | background-color: rgba(0,0,0,0.25); 130 | } 131 | .Julie-Alert { 132 | color: #6b6b6b; 133 | opacity: 0; 134 | display: none; 135 | flex-direction: column; 136 | align-items: center; 137 | position: fixed; 138 | width: 450px; 139 | min-height: 200px; 140 | top: 50%; 141 | left: calc(50% - 225px); 142 | background-color: #fff; 143 | border: 1px solid #fff; 144 | border-radius: 5px; 145 | z-index: 1000; 146 | transition: all 0.7s ease; 147 | } 148 | .Julie-Alert h2 { 149 | font-family: Bad script; 150 | margin: 20px 0 5px 0; 151 | } 152 | .Julie-Alert .Alert-content { 153 | display: block; 154 | margin: 0; 155 | padding: 20px 20px 0px 20px; 156 | } 157 | .Julie-Alert .Alert-btn-container { 158 | display: block; 159 | position: relative; 160 | margin: 0 auto; 161 | padding: 30px 0 10px 0; 162 | } 163 | .Julie-Alert .Alert-btn-container button { 164 | display: inline-block; 165 | margin: 10px 10px; 166 | padding: 10px 30px 10px 30px; 167 | border: 2px solid #6b6b6b; 168 | border-radius: 5px; 169 | color: #fff; 170 | font-size: 18px; 171 | font-weight: 400; 172 | outline: none; 173 | cursor: pointer; 174 | transition: all 0.25s ease; 175 | } 176 | .Julie-Alert .Alert-btn-container button a { 177 | text-decoration: none; 178 | } 179 | .Julie-Alert .Alert-btn-container button:hover { 180 | transition: all 0.5s ease; 181 | border-color: #fff; 182 | color: #fff; 183 | } 184 | .Julie-Alert .Alert-btn-container button:hover > a { 185 | color: #fff; 186 | } 187 | .Julie-Alert .Alert-btn-container .confirm { 188 | color: #91c8ff; 189 | border-color: #91c8ff; 190 | background-color: transparent; 191 | } 192 | .Julie-Alert .Alert-btn-container .confirm a { 193 | color: #91c8ff; 194 | } 195 | .Julie-Alert .Alert-btn-container .confirm:hover { 196 | background-color: #91c8ff; 197 | } 198 | .Julie-Alert .Alert-btn-container .error { 199 | color: #fc9f8d; 200 | border-color: #fc9f8d; 201 | background-color: transparent; 202 | } 203 | .Julie-Alert .Alert-btn-container .error a { 204 | color: #fc9f8d; 205 | } 206 | .Julie-Alert .Alert-btn-container .error:hover { 207 | background-color: #fc9f8d; 208 | } 209 | .showJulieAlertBoard { 210 | -webkit-animation: showAlertBoard 0.3s; 211 | animation: showAlertBoard 0.3s; 212 | opacity: 0.7; 213 | display: block; 214 | } 215 | .showJulieAlert { 216 | -webkit-animation: showAlert 0.3s; 217 | animation: showAlert 0.3s; 218 | } 219 | .showJulieAlertPop { 220 | -webkit-animation: showAlertPop 0.25s; 221 | animation: showAlertPop 0.25s; 222 | animation-delay: 0.125s; 223 | } 224 | .hideJulieAlert { 225 | -webkit-animation: hideAlert 0.3s; 226 | animation: hideAlert 0.3s; 227 | } 228 | @media (max-width: 768px) { 229 | .Julie { 230 | border: none; 231 | } 232 | .Julie .Julie-title { 233 | width: 150px; 234 | height: 70px; 235 | } 236 | .Julie .Julie-title h1 { 237 | font-size: 30px; 238 | } 239 | .Julie .Julie-content { 240 | margin: 30px 0; 241 | width: 100%; 242 | } 243 | .Julie .Julie-content .Julie-extra { 244 | font-size: 0.85em; 245 | } 246 | .Julie .Julie-content .Julie-btn { 247 | height: 150px; 248 | width: 80%; 249 | } 250 | .Julie-Alert { 251 | min-width: 250px; 252 | min-height: 200px; 253 | } 254 | } 255 | @-moz-keyframes showAlertBoard { 256 | 0% { 257 | display: none; 258 | opacity: 0; 259 | } 260 | 1% { 261 | transform: scale(0.1); 262 | -webkit-transform: scale(0.1); 263 | display: block; 264 | opacity: 0; 265 | border-radius: 50%; 266 | } 267 | 100% { 268 | transform: scale(1); 269 | -webkit-transform: scale(1); 270 | opacity: 0.7; 271 | border-radius: 1px; 272 | } 273 | } 274 | @-webkit-keyframes showAlertBoard { 275 | 0% { 276 | display: none; 277 | opacity: 0; 278 | } 279 | 1% { 280 | transform: scale(0.1); 281 | -webkit-transform: scale(0.1); 282 | display: block; 283 | opacity: 0; 284 | border-radius: 50%; 285 | } 286 | 100% { 287 | transform: scale(1); 288 | -webkit-transform: scale(1); 289 | opacity: 0.7; 290 | border-radius: 1px; 291 | } 292 | } 293 | @-o-keyframes showAlertBoard { 294 | 0% { 295 | display: none; 296 | opacity: 0; 297 | } 298 | 1% { 299 | transform: scale(0.1); 300 | -webkit-transform: scale(0.1); 301 | display: block; 302 | opacity: 0; 303 | border-radius: 50%; 304 | } 305 | 100% { 306 | transform: scale(1); 307 | -webkit-transform: scale(1); 308 | opacity: 0.7; 309 | border-radius: 1px; 310 | } 311 | } 312 | @keyframes showAlertBoard { 313 | 0% { 314 | display: none; 315 | opacity: 0; 316 | } 317 | 1% { 318 | transform: scale(0.1); 319 | -webkit-transform: scale(0.1); 320 | display: block; 321 | opacity: 0; 322 | border-radius: 50%; 323 | } 324 | 100% { 325 | transform: scale(1); 326 | -webkit-transform: scale(1); 327 | opacity: 0.7; 328 | border-radius: 1px; 329 | } 330 | } 331 | @-moz-keyframes showAlert { 332 | 0% { 333 | transform: scale(0.8); 334 | -webkit-transform: scale(0.8); 335 | opacity: 0.3; 336 | } 337 | 70% { 338 | opacity: 1; 339 | } 340 | 100% { 341 | transform: scale(1); 342 | -webkit-transform: scale(1); 343 | opacity: 1; 344 | } 345 | } 346 | @-webkit-keyframes showAlert { 347 | 0% { 348 | transform: scale(0.8); 349 | -webkit-transform: scale(0.8); 350 | opacity: 0.3; 351 | } 352 | 70% { 353 | opacity: 1; 354 | } 355 | 100% { 356 | transform: scale(1); 357 | -webkit-transform: scale(1); 358 | opacity: 1; 359 | } 360 | } 361 | @-o-keyframes showAlert { 362 | 0% { 363 | transform: scale(0.8); 364 | -webkit-transform: scale(0.8); 365 | opacity: 0.3; 366 | } 367 | 70% { 368 | opacity: 1; 369 | } 370 | 100% { 371 | transform: scale(1); 372 | -webkit-transform: scale(1); 373 | opacity: 1; 374 | } 375 | } 376 | @keyframes showAlert { 377 | 0% { 378 | transform: scale(0.8); 379 | -webkit-transform: scale(0.8); 380 | opacity: 0.3; 381 | } 382 | 70% { 383 | opacity: 1; 384 | } 385 | 100% { 386 | transform: scale(1); 387 | -webkit-transform: scale(1); 388 | opacity: 1; 389 | } 390 | } 391 | @-moz-keyframes showAlertPop { 392 | 0% { 393 | transform: scale(0.7); 394 | -webkit-transform: scale(0.7); 395 | opacity: 0; 396 | } 397 | 1% { 398 | opacity: 1; 399 | } 400 | 50% { 401 | transform: scale(1.03); 402 | -webkit-transform: scale(1.03); 403 | opacity: 1; 404 | } 405 | 70% { 406 | transform: scale(0.9); 407 | -webkit-transform: scale(0.9); 408 | opacity: 1; 409 | } 410 | 100% { 411 | transform: scale(1); 412 | -webkit-transform: scale(1); 413 | opacity: 1; 414 | } 415 | } 416 | @-webkit-keyframes showAlertPop { 417 | 0% { 418 | transform: scale(0.7); 419 | -webkit-transform: scale(0.7); 420 | opacity: 0; 421 | } 422 | 1% { 423 | opacity: 1; 424 | } 425 | 50% { 426 | transform: scale(1.03); 427 | -webkit-transform: scale(1.03); 428 | opacity: 1; 429 | } 430 | 70% { 431 | transform: scale(0.9); 432 | -webkit-transform: scale(0.9); 433 | opacity: 1; 434 | } 435 | 100% { 436 | transform: scale(1); 437 | -webkit-transform: scale(1); 438 | opacity: 1; 439 | } 440 | } 441 | @-o-keyframes showAlertPop { 442 | 0% { 443 | transform: scale(0.7); 444 | -webkit-transform: scale(0.7); 445 | opacity: 0; 446 | } 447 | 1% { 448 | opacity: 1; 449 | } 450 | 50% { 451 | transform: scale(1.03); 452 | -webkit-transform: scale(1.03); 453 | opacity: 1; 454 | } 455 | 70% { 456 | transform: scale(0.9); 457 | -webkit-transform: scale(0.9); 458 | opacity: 1; 459 | } 460 | 100% { 461 | transform: scale(1); 462 | -webkit-transform: scale(1); 463 | opacity: 1; 464 | } 465 | } 466 | @keyframes showAlertPop { 467 | 0% { 468 | transform: scale(0.7); 469 | -webkit-transform: scale(0.7); 470 | opacity: 0; 471 | } 472 | 1% { 473 | opacity: 1; 474 | } 475 | 50% { 476 | transform: scale(1.03); 477 | -webkit-transform: scale(1.03); 478 | opacity: 1; 479 | } 480 | 70% { 481 | transform: scale(0.9); 482 | -webkit-transform: scale(0.9); 483 | opacity: 1; 484 | } 485 | 100% { 486 | transform: scale(1); 487 | -webkit-transform: scale(1); 488 | opacity: 1; 489 | } 490 | } 491 | @-moz-keyframes hideAlert { 492 | 0% { 493 | transform: scale(1); 494 | -webkit-transform: scale(1); 495 | opacity: 1; 496 | } 497 | 100% { 498 | transform: scale(0.4); 499 | -webkit-transform: scale(0.4); 500 | opacity: 0; 501 | display: none; 502 | } 503 | } 504 | @-webkit-keyframes hideAlert { 505 | 0% { 506 | transform: scale(1); 507 | -webkit-transform: scale(1); 508 | opacity: 1; 509 | } 510 | 100% { 511 | transform: scale(0.4); 512 | -webkit-transform: scale(0.4); 513 | opacity: 0; 514 | display: none; 515 | } 516 | } 517 | @-o-keyframes hideAlert { 518 | 0% { 519 | transform: scale(1); 520 | -webkit-transform: scale(1); 521 | opacity: 1; 522 | } 523 | 100% { 524 | transform: scale(0.4); 525 | -webkit-transform: scale(0.4); 526 | opacity: 0; 527 | display: none; 528 | } 529 | } 530 | @keyframes hideAlert { 531 | 0% { 532 | transform: scale(1); 533 | -webkit-transform: scale(1); 534 | opacity: 1; 535 | } 536 | 100% { 537 | transform: scale(0.4); 538 | -webkit-transform: scale(0.4); 539 | opacity: 0; 540 | display: none; 541 | } 542 | } -------------------------------------------------------------------------------- /julie.js: -------------------------------------------------------------------------------- 1 | $('.basic button').click(function(){ 2 | Julie({ 3 | title: "Julie!", 4 | text: "Nice to meet you!", 5 | confirmText:"got it", 6 | errorText:"", 7 | Pop:false, 8 | }); 9 | }); 10 | 11 | $('.try-pop button').click(function(){ 12 | Julie({ 13 | title: "Pop!", 14 | text: "animation feature,Pop-Style", 15 | confirmText: "Know!", 16 | errorText:"", 17 | Pop: true 18 | }); 19 | }); 20 | 21 | 22 | $(".try-confirm button").click(function(){ 23 | Julie({ 24 | title: "Cool!Right?", 25 | text: "click the button below!", 26 | errorText: JulieUrl("really?","https://github.com/lichin-lin/Juliealert"), 27 | Pop:false 28 | }); 29 | }); 30 | 31 | $(".try-error button").click(function(){ 32 | Julie({ 33 | title: "Wait!there's more", 34 | text: "

last demo style!
IT IS FANCY
HTML element

", 35 | confirmText: "bro!", 36 | errorText:"I will miss you!!", 37 | Pop:false 38 | }); 39 | }); 40 | 41 | 42 | // ===== Function Start ===== 43 | function Julie(content){ 44 | if(isEmpty(content.errorText)){ 45 | $('.Julie-Alert .error').css("display","none"); 46 | }else{ 47 | $('.Julie-Alert .error').css("display","inline-block"); 48 | } 49 | if(isEmpty(content.confirmText)){ 50 | $('.Julie-Alert .confirm').css("display","none"); 51 | }else{ 52 | $('.Julie-Alert .confirm').css("display","inline-block"); 53 | } 54 | console.log(content.confirmText); 55 | $('.Julie-Alert h2').text(content.title); 56 | $('.Julie-Alert .Alert-content').html(content.text); 57 | $('.Julie-Alert .confirm').html(content.confirmText); 58 | $('.Julie-Alert .error').html(content.errorText); 59 | 60 | $('body').addClass("stop-scroll"); 61 | 62 | $('.Julie-board').css({ 63 | width: FindLarge()+200, 64 | height: FindLarge()+200, 65 | top: topOffset()-100 + "px", 66 | left: leftOffset()-100 + "px", 67 | }).addClass('showJulieAlertBoard'); 68 | 69 | $('.Julie-Alert') 70 | .removeClass('hideJulieAlert') 71 | .css({ 72 | display:"flex", 73 | opacity:1, 74 | "margin-top": -$('.Julie-Alert').height()/2 75 | }) 76 | if(!content.Pop){ 77 | $('.Julie-Alert').addClass('showJulieAlert'); 78 | }else{ 79 | $('.Julie-Alert').addClass('showJulieAlertPop'); 80 | } 81 | 82 | 83 | 84 | $('.Julie-Alert button').click(function(){ 85 | $('body').removeClass("stop-scroll"); 86 | $('.Julie-board').removeClass('showJulieAlertBoard'); 87 | $('.Julie-Alert').removeClass('showJulieAlert'); 88 | $('.Julie-Alert').removeClass('showJulieAlertPop'); 89 | $('.Julie-Alert') 90 | .addClass('hideJulieAlert') 91 | .css({ 92 | display:"none", 93 | opacity:0 94 | }); 95 | }); 96 | 97 | } 98 | 99 | function JulieUrl(name,url){ 100 | return " " + name + " "; 101 | } 102 | function isEmpty(str) { 103 | return typeof str == 'string' && !str.trim() || typeof str == 'undefined' || str === null; 104 | } 105 | function FindLarge(){ 106 | return $(window).width() > $(window).height() ? $(window).width() : $(window).height(); 107 | } 108 | function topOffset(){ 109 | return $(window).width() > $(window).height() ? $(window).height()/2 - $(window).width()/2 : 0; 110 | } 111 | function leftOffset(){ 112 | return $(window).width() > $(window).height() ? 0 : $(window).width()/2 - $(window).height()/2; 113 | } --------------------------------------------------------------------------------