Setting options in the configuration object of the .jsPanel()
function will set options for the individual jsPanel. It will not change options globally. To see how to change the defaults globally go down to the defaults section.
This option is one of several ways to load content into the jsPanel. Additional ways to load content are provided by option.content and option.load. Option.load internally uses the native jQuery method .load()
Type: object
Default: false
The settings of the option.ajax configuration object are used the same way as the arguments for jQuery.ajax() are used.
For detailed information about the jQuery.ajax() configuration refer to the jQuery API
- $(‘#option-ajax’).jsPanel(
- size:‘auto’,
- ajax:
- url:‘files/example-ajax.html’
- );
The option.ajax settings object accepts the following additional settings:
- done: function( data, textStatus, jqXHR, jsPanel )
A function that will be passed to jQuerys .done() callback and receives the same arguments as jQuerys .done() callback plus the jsPanel as fourth argument. - fail: function( jqXHR, textStatus, errorThrown, jsPanel )
A function that will be passed to jQuerys .fail() callback and receives the same arguments as jQuerys .fail() callback plus the jsPanel as fourth argument. - always: function( data|jqXHR, textStatus, jqXHR|errorThrown, jsPanel )
A function that will be passed to jQuerys .always() callback and receives the same arguments as jQuerys .always() callback plus the jsPanel as fourth argument.
In response to a successful request, the function’s arguments are the same as those of .done(): data, textStatus, and the jqXHR object plus the jsPanel as fourth argument.
For failed requests the arguments are the same as those of .fail(): the jqXHR object, textStatus, and errorThrown plus the jsPanel as fourth argument. - then: function( data, textStatus, jqXHR, jsPanel ) , function( jqXHR, textStatus, errorThrown, jsPanel )
Expects an array of two functions. The first function serves as callback for a successful request, the second one as callback for a failed request.
- $(‘#option-ajax’).jsPanel(
- size:‘auto’,
- position: top:770, left:15,
- ajax:
- url:‘files/example-ajax-2.html’,
- done:function( data, textStatus, jqXHR, jsPanel )
- console.log(‘jqXHR status: ‘+ jqXHR.status +‘ ‘+ jqXHR.statusText +‘ ‘+ textStatus );
- ,
- fail:function( jqXHR, textStatus, errorThrown, jsPanel )
- $(‘.panel-body’, jsPanel ).append( jqXHR.responseText );
- ,
- always:function( arg1, textStatus, arg3, jsPanel )
- console.log( textStatus );
- );
- $(‘#option-ajax’).jsPanel(
- size:‘auto’,
- position: top:1187, left:15,
- ajax:
- url:‘files/example-ajax-3.html’,
- then:[
- function( data, textStatus, jqXHR, jsPanel )
- jsPanel.title('Example for option.ajax.then');
- console.log( textStatus )
- ,
- function( jqXHR, textStatus, errorThrown, jsPanel )
- $('.panel-body', jsPanel ).append( jqXHR.responseText );
- console.log( errorThrown )
- ]
- );
option.autoclose
This option allows the jsPanel to close automatically after the specified time in milliseconds.
Type: number
Default: false
- $(‘#option-autoclose’).jsPanel(
- autoclose:4000
- );
and wait a few seconds to see the jsPanel close automatically
option.content
This option is one of several ways to load content into the jsPanel. Additional ways to load content are provided by option.load and option.ajax.
Type: string | function | jQuery object
Default: false
- $(‘#option-content’).jsPanel(
- content:“<div class=’preloader’><img src=’images/pl.gif’></div>”,
- position:‘center’
- );
- $(‘#option-content’).jsPanel(
- content:function()return“<div class=’preloader’><img src=’images/pl.gif’></div>”;,
- position:‘center’
- );
- $(‘#option-content’).jsPanel(
- content: $(‘<p>Lorem ipsum …</p>’).css(padding:’20px’,‘text-align’:‘center’),
- position:‘center’
- );
jsPanel : jQuery Floating Panels plugin for Bootstrap
No comments:
Post a Comment