2017 © Pedro Peláez
 

component jquerydialogextendjs

Maximize and Minimize Buttons for UI Dialog

image

wheregroup/jquerydialogextendjs

Maximize and Minimize Buttons for UI Dialog

  • Thursday, April 20, 2017
  • by eSlider
  • Repository
  • 3 Watchers
  • 0 Stars
  • 1,882 Installations
  • CoffeeScript
  • 2 Dependents
  • 0 Suggesters
  • 65 Forks
  • 0 Open issues
  • 2 Versions
  • 30 % Grown

The README.md

jQueryUI dialog addon that adds collapse / minimize / maximize interactions. Forked from ROMB/jquery-dialogextend. See original license., (*1)

Compatible

  • jQuery 1.11.1
  • jQueryUI 1.11.0

Overview

  • Extending (instead of replacing) original jQuery UI dialog
  • Maximize and minimize buttons
  • Show/Hide close button
  • Double-clickable title bar
  • Configurable icons
  • Custom events

Demo

Tested Browsers

  • Chrome 35
  • Firefox 14
  • IE 8

Please support this project

Donate Bitcoins: 1G8T7Xh2AN5ceduHmHT5TpPFUeddsnQHLQ, (*2)

Options

closable

Type: Boolean, (*3)

Usage: enable/disable close button, (*4)

Default: true, (*5)

maximizable

Type: Boolean, (*6)

Usage: enable/disable maximize button, (*7)

Default: false, (*8)

minimizable

Type: Boolean, (*9)

Usage: enable/disable minimize button, (*10)

Default: false, (*11)

collapsable

Type: Boolean, (*12)

Usage: enable/disable collapse button, (*13)

Default: false, (*14)

minimizeLocation

Type: String, (*15)

Usage: sets alignment of minimized dialogues, (*16)

Default: 'left', (*17)

Valid: 'left', 'right', (*18)

dblclick

Type: Boolean, String, (*19)

Usage: set action on double click, (*20)

Default: false, (*21)

Valid: false, 'maximize', 'minimize', 'collapse', (*22)

icons

Type: Object, (*23)

Default:, (*24)

{
  "close" : "ui-icon-circle-closethick", // new in v1.0.1
  "maximize" : "ui-icon-extlink",
  "minimize" : "ui-icon-minus",
  "restore" : "ui-icon-newwin"
}

Valid: <jQuery UI icon class>, (*25)

Events

load

Type: load, (*26)

Example:, (*27)

//Specify callback as init option
$("#my-dialog").dialogExtend({
  "load" : function(evt, dlg) { ... }
});
//Bind to event by type
//NOTE : You must bind() the <dialogextendload> event before dialog-extend is created
$("#my-dialog")
  .bind("dialogextendload", function(evt) { ... })
  .dialogExtend();

beforeCollapse

Type: beforeCollapse, (*28)

Example:, (*29)

//Specify callback as init option
$("#my-dialog").dialogExtend({
  "beforeCollapse" : function(evt) { ... }
});
//Bind to event by type
$("#my-dialog").bind("dialogextendbeforeCollapse", function(evt) { ... });

beforeMaximize

Type: beforeMaximize, (*30)

Example:, (*31)

//Specify callback as init option
$("#my-dialog").dialogExtend({
  "beforeMaximize" : function(evt) { ... }
});
//Bind to event by type
$("#my-dialog").bind("dialogextendbeforeMaximize", function(evt) { ... });

beforeMinimize

Type: beforeMinimize, (*32)

Example:, (*33)

//Specify callback as init option
$("#my-dialog").dialogExtend({
  "beforeMinimize" : function(evt) { ... }
});
//Bind to event by type
$("#my-dialog").bind("dialogextendbeforeMinimize", function(evt) { ... });

beforeRestore

Type: beforeRestore, (*34)

Example:, (*35)

//Specify callback as init option
$("#my-dialog").dialogExtend({
  "beforeRestore" : function(evt) { ... }
});
//Bind to event by type
$("#my-dialog").bind("dialogextendbeforeRestore", function(evt) { ... });

collapse

Type: collapse, (*36)

Example:, (*37)

//Specify callback as init option
$("#my-dialog").dialogExtend({
  "collapse" : function(evt) { ... }
});
//Bind to event by type
$("#my-dialog").bind("dialogextendcollapse", function(evt) { ... });

maximize

Type: maximize, (*38)

Example:, (*39)

//Specify callback as init option
$("#my-dialog").dialogExtend({
  "maximize" : function(evt) { ... }
});
//Bind to event by type
$("#my-dialog").bind("dialogextendmaximize", function(evt) { ... });

minimize

Type: minimize, (*40)

Example:, (*41)

//Specify callback as init option
$("#my-dialog").dialogExtend({
  "minimize" : function(evt) { ... }
});
//Bind to event by type
$("#my-dialog").bind("dialogextendminimize", function(evt) { ... });

restore

Type: restore, (*42)

Example:, (*43)

//Specify callback as init option
$("#my-dialog").dialogExtend({
  "restore" : function(evt) { ... }
});
//Bind to event by type
$("#my-dialog").bind("dialogextendrestore", function(evt) { ... });

Methods

collapse

Usage: Collapse the dialog without double-clicking the title bar, (*44)

Trigger: dialogextendbeforeCollapse, dialogextendcollapse, (*45)

Example:, (*46)

$("#my-dialog").dialogExtend("collapse");

maximize

Usage: Maximize the dialog without clicking the button, (*47)

Trigger: dialogextendbeforeMaximize, dialogextendmaximize, (*48)

Example:, (*49)

$("#my-dialog").dialogExtend("maximize");

minimize

Usage: Minimize the dialog without clicking the button, (*50)

Trigger: dialogextendbeforeMinimize, dialogextendminimize, (*51)

Example:, (*52)

$("#my-dialog").dialogExtend("minimize");

restore

Usage: Restore the dialog from maximized/minimized/collapsed state without clicking the button, (*53)

Trigger: dialogextendbeforeRestore, dialogextendrestore, (*54)

Example:, (*55)

$("#my-dialog").dialogExtend("restore");

state

Usage: Get current state of dialog, (*56)

Return: String, (*57)

Value: 'normal', 'maximized', 'minimized', 'collapsed', (*58)

Example:, (*59)

switch ( $("#my-dialog").dialogExtend("state") ) {
  case "maximized":
    alert("The dialog is maximized");
    break;
  case "minimized":
    alert("The dialog is minimized");
    break;
  case "collapsed":
    alert("The dialog is collapsed");
    break;
  default:
    alert("The dialog is normal");
}

Theming

The dialog will have class according to its current state., (*60)

<div class="ui-dialog jqdx-state-{normal|maximized|minimized|collapsed}">
  <div class="ui-dialog-titlebar">...</div>
  <div class="ui-dialog-content ui-dialog-{normal|maximized|minimized|collapsed}">...</div>
</div>

The buttons are wrapped by title bar of jQuery UI Dialog., (*61)

Note : After using dialogExtend, close button will not be a direct child of title bar anymore. It will be wrapped by a button pane element, (*62)

<div class="ui-dialog-titlebar ui-widget-header ui-corner-all ui-helper-clearfix">
  ...
  <div class="ui-dialog-titlebar-buttonpane">
    <a class="ui-dialog-titlebar-maximize ui-corner-all" href="#"><span class="ui-icon {icons.maximize}">maximize</span></a>
    <a class="ui-dialog-titlebar-minimize ui-corner-all" href="#"><span class="ui-icon {icons.minimize}">minimize</span></a>
    <a class="ui-dialog-titlebar-restore ui-corner-all" href="#"><span class="ui-icon {icons.restore}">restore</span></a>
    <button type="button" class="ui-dialog-titlebar-close ui-corner-all" href="#">...</button>
  </div>
  ...
</div>

Example - Basic Config

$(function(){
  $("#my-button").click(function(){
    $("
This is content

") .dialog({ "title" : "My Dialog" }) .dialogExtend({ "maximizable" : true, "dblclick" : "maximize", "icons" : { "maximize" : "ui-icon-arrow-4-diag" } }); }); });, (*63)

Example - Full Config

$(function(){
  $("#my-button").click(function(){
    $("
This is content

") .dialog({ "title" : "This is dialog title", "buttons" : { "OK" : function(){ $(this).dialog("close"); } } }) .dialogExtend({ "closable" : true, "maximizable" : true, "minimizable" : true, "collapsable" : true, "dblclick" : "collapse", "minimizeLocation" : "right", "icons" : { "close" : "ui-icon-circle-close", "maximize" : "ui-icon-circle-plus", "minimize" : "ui-icon-circle-minus", "collapse" : "ui-icon-triangle-1-s", "restore" : "ui-icon-bullet" }, "load" : function(evt, dlg){ alert(evt.type); }, "beforeCollapse" : function(evt, dlg){ alert(evt.type); }, "beforeMaximize" : function(evt, dlg){ alert(evt.type); }, "beforeMinimize" : function(evt, dlg){ alert(evt.type); }, "beforeRestore" : function(evt, dlg){ alert(evt.type); }, "collapse" : function(evt, dlg){ alert(evt.type); }, "maximize" : function(evt, dlg){ alert(evt.type); }, "minimize" : function(evt, dlg){ alert(evt.type); }, "restore" : function(evt, dlg){ alert(evt.type); } }); }); });, (*64)

The Versions

20/04 2017

dev-master

9999999-dev https://github.com/ROMB/jquery-dialogextend

Maximize and Minimize Buttons for UI Dialog

  Sources   Download

MIT

The Requires

 

20/04 2017

2.0.4

2.0.4.0 https://github.com/ROMB/jquery-dialogextend

Maximize and Minimize Buttons for UI Dialog

  Sources   Download

MIT

The Requires