1.0.0 • Published 8 years ago

upperbox v1.0.0

Weekly downloads
4
License
MIT
Repository
github
Last release
8 years ago

upperBox


A simple JQuery modal to show content with style to users.

No more shit(no more extra images or fonts), Just 1KB.js + 2KB.css + 85KB.JQuery.js :D

In the future I will develop a lighter version of upperBox without JQuery.

Installation

  • Bower: bower install upperbox
  • NPM: npm install upperbox

How to use

  1. Add a link to the CSS file Inside <head> tag:

    <link rel="stylesheet" href="../upperbox/upperbox.min.css">

  2. Add JQuery and upperBox script tags before </body>:

    <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.1.0/jquery.min.js"></script>
    
    <script src="../upperbox/upperbox.min.js"></script>
  3. Call upperBox after above scripts:

    $("body").upperbox({
    	content: 'Hello world...'
    });

    Hint: $("body") is where upperBox insert it's element into.

Settings

OptionTypeDefaultDescription
contentstring___Text block you want to show
positionstringrelative"relative" or "fixed". If "relative" is used, you can show multiple upperBox togheter. If "fixed" is used, upperBox will sit in center of the display.
animatestringslide"slide" or "fade". Both use JQuery effect.
classstring___Any additional CSS class. If you want override the style.
destroyElembooleantrueBy pressing close button, modal should be deleted or not
templateIDstring___If you want to use another template you should specify where your template is

Extend

In normal usage, there is no need to create a template before JS process in HTML file; But if you want to use another template, you can specify templateID option and put the new template inside a script tag like below:

<script type="text/template" id="newTemplate">
	<div class="upperbox" style="display:none">
		...
	</div>
</script>

More examples.