Extra Components Documentation

Sweet Alerts

A beautiful replacement for javascript's "alert". SweetAlert automatically centers itself on the page and looks great no matter if you're using a desktop computer, mobile or tablet. It's even highly customizable.

1. Initialize the plugin by referencing the necessary files:
                
                    <script src="sweetalert.min.js"></script>
                    <link rel="stylesheet" type="text/css" href="sweetalert.css">
                
            
2. Call the sweetAlert-function after the page has loaded
                
                    swal({
                        title: "Error!",
                        text: "Here's my error message!",
                        type: "error",
                        confirmButtonText: "Cool"
                    });
                
            

Refer following links for detailed documentation, configuration options, methods and examples:

Type URL
Plugin Link http://t4t5.github.io/sweetalert/
Template Page https://pixinvent.com/modern-admin-clean-bootstrap-4-dashboard-html-template/html/ltr/vertical-menu-template/ex-component-sweet-alerts.html

Toastr

toastr is a Javascript library for Gnome / Growl type non-blocking notifications.

1. Initialize the plugin by referencing the necessary files:
                
                    <script src="toastr.js"></script>
                    <link rel="stylesheet" type="text/css" href="toastr.css">
                
            
2. Use toastr to display a toast for info, success, warning or error.
                
                    // Display an info toast with no title
                    toastr.info('Are you the 6 fingered man?')
                
            

Refer following links for detailed documentation, configuration options, methods and examples:

Type URL
Plugin Link https://github.com/CodeSeven/toastr
Template Page https://pixinvent.com/modern-admin-clean-bootstrap-4-dashboard-html-template/html/ltr/vertical-menu-template/ex-component-toastr.html

jQuery Raty

jQuery Raty - A Star Rating Plugin

Usage with Image


1. Initialize the plugin by referencing the necessary files:
                    
                        <script src="jquery.raty.js"></script>
                    
                
2. The component will bind to any existing DOM element.
                    
                        <div id="star-rating"></div>
                    
                
3. Basic usage may look something like this.
                    
                        $('#star-rating').raty();
                    
                

Usage with Font


1. Initialize the plugin by referencing the necessary files:
                    
                        <script src="jquery.raty.js"></script>
                        <link rel="stylesheet" type="text/css" href="jquery.raty.css">
                    
                
2. The component will bind to any existing DOM element.
                    
                        <div id="star-rating"></div>
                    
                
3. Basic usage may look something like this.
                    
                        $('#star-rating').raty({ starType: 'i' });
                    
                

Refer following links for detailed documentation, configuration options, methods and examples:

Type URL
Plugin Link https://github.com/wbotelhos/raty
Template Page https://pixinvent.com/modern-admin-clean-bootstrap-4-dashboard-html-template/html/ltr/vertical-menu-template/ex-component-ratings.html

NoUI Slider

noUiSlider is a lightweight JavaScript range slider library. It offers a wide selection of options and settings, and is compatible with a ton of (touch) devices, including those running iOS, Android, Windows 8/8.1/10, Windows Phone 8.1 and Windows Mobile 10.

1. Initialize the plugin by referencing the necessary files:
                
                    <script src="nouislider.min.js"></script>
                    <link rel="stylesheet" type="text/css" href="nouislider.min.css">
                
            
2. Binding to existing DOM element.
                
                    <div id="slider"></div>
                
            
3. Basic usage may look something like this.
                
                    var slider = document.getElementById('slider');

                    noUiSlider.create(slider, {
                        start: [20, 80],
                        connect: true,
                        range: {
                            'min': 0,
                            'max': 100
                        }
                    });
                
            

Refer following links for detailed documentation, configuration options, methods and examples:

Type URL
Plugin Link https://refreshless.com/nouislider/
Template Page https://pixinvent.com/modern-admin-clean-bootstrap-4-dashboard-html-template/html/ltr/vertical-menu-template/ex-component-noui-slider.html

Knob

Nice, downward compatible, touchable, jQuery dial.

1. Initialize the plugin by referencing the necessary files:
                
                    <script src="jquery.knob.min.js"></script>
                
            
2. Binding component to DOM element.
                
                    <input type="text" value="75" class="dial">
                
            
3. Basic usage may look something like this.
                
                    $(function() {
                        $(".dial").knob();
                    });
                
            

Refer following links for detailed documentation, configuration options, methods and examples:

Type URL
Plugin Link http://anthonyterrien.com/knob/
Template Page https://pixinvent.com/modern-admin-clean-bootstrap-4-dashboard-html-template/html/ltr/vertical-menu-template/ex-component-knob.html

Image Cropper

The jQuery BlockUI Plugin lets you simulate synchronous behavior when using AJAX, without locking the browser. When activated, it will prevent user activity with the page (or part of the page) until it is deactivated. BlockUI adds elements to the DOM to give it both the appearance and behavior of blocking user interaction.

1. Initialize the plugin by referencing the necessary files:
                
                    <script src="/path/to/cropper.js"></script>
                    <link rel="stylesheet" type="text/css" href="/path/to/cropper.css">
                
            
2. Wrap the image or canvas element with a block element (container).
                
                    <div>
                        <img id="image" src="picture.jpg">
                    </div>
                
            
3. Limit image width to avoid overflow the container.
                
                    img {
                        max-width: 100%; /* This rule is very important, please do not ignore this! */
                    }
                
            
3. Basic usage may look something like this.
                
                    $('#image').cropper({
                        aspectRatio: 16 / 9,
                            crop: function(e) {
                            // Output the result data for cropping image.
                            console.log(e.x);
                            console.log(e.y);
                            console.log(e.width);
                            console.log(e.height);
                            console.log(e.rotate);
                            console.log(e.scaleX);
                            console.log(e.scaleY);
                        }
                    });
                
            

Dropzone

DropzoneJS is an open source library that provides drag’n’drop file uploads with image previews. It’s lightweight, doesn't depend on any other library (like jQuery) and is highly customizable.

1. Initialize the plugin by referencing the necessary files:
                
                    <script src="/path/to/dropzone.min.js"></script>
                
            
2. The typical way of using dropzone is by creating a form element with the class dropzone. That’s it. Dropzone will find all form elements with the class dropzone, automatically attach itself to it, and upload files dropped into it to the specified action attribute. The uploaded files can be handled just as if there would have been a html input.
                
                    <form action="/file-upload" class="dropzone">
                        <div class="fallback">
                            <input name="file" type="file" multiple />
                        </div>
                    </form>
                
            
3. Alternatively you can create dropzones programmatically (even on non form elements) by instantiating the Dropzone class
                
                    // Dropzone class:
                    var myDropzone = new Dropzone("div#myId", { url: "/file/post"});
                
            
                
                    // jQuery
                    $("div#myId").dropzone({ url: "/file/post" });
                
            

Notes


  • If you do not want the default message at all (»Drop files to upload (or click)«), you can put an element inside your dropzone element with the class dz-message and dropzone will not create the message for you.
  • Dropzone will submit any hidden fields you have in your dropzone form. So this is an easy way to submit additional data. You can also use the params option.
  • Dropzone adds data to the file object you can use when events fire. You can access file.width and file.height if it’s an image, as well as file.upload which is an object containing: progress (0-100), total (the total bytes) and bytesSent.
  • If you want to add additional data to the file upload that has to be specific for each file, you can register for the sending event:
                            
                                myDropzone.on("sending", function(file, xhr, formData) {
                                    // Will send the filesize along with the file as POST data.
                                    formData.append("filesize", file.size);
                                });
                            
                        
  • To access the preview html of a file, you can access file.previewElement. For example:
                            
                                myDropzone.on("addedfile", function(file) {
                                    file.previewElement.addEventListener("click", function() {
                                        myDropzone.removeFile(file);
                                    });
                                });
                            
                        
  • If you want the whole body to be a Dropzone and display the files somewhere else you can simply instantiate a Dropzone object for the body, and define the previewsContainer option. The previewsContainer should have the dropzone-previews or dropzone class to properly display the file previews.
                            
                                new Dropzone(document.body, {
                                    previewsContainer: ".dropzone-previews",
                                    // You probably don't want the whole body
                                    // to be clickable to select files
                                    clickable: false
                                });
                            
                        
  • Look at the github wiki for more examples.