BX.SidePanel.Instance
Class is the main software interface to handle the slider. It is the singleton-object.
BX.SidePanel.Instance.open method
BX.SidePanel.Instance.open( url[, options] )
This method opens a page inside the slider with the specified address in the URL parameter. Returns true, if the slider has opened successfully, otherwise returns false.
Parameters
Parameter | Description | Type |
---|---|---|
url | Address of the page, which will be opened in the slider's iframe. For sliders with their individual content (contentCallback option is specified), a unique identifier is specified in this parameter. | string |
options | Collection of the slider options. All settings are optional.
| Object |
Example
Example of slider with its own content and data.
BX.SidePanel.Instance.open("crm:activity-view", { //Forward your own data into slider data: { minRepeats: 30, maxRepeats: 100, repeatString: "==========" }, contentCallback: function(slider) { var promise = new BX.Promise(); //Emulation of asynchronous operation (as a rule, its ajax) setTimeout(function() { //Read your data var minRepeats = slider.getData().get("minRepeats"); var maxRepeats = slider.getData().get("maxRepeats"); var repeatString = slider.getData().get("repeatString"); var repeats = Math.floor(Math.random() * (maxRepeats - minRepeats) + minRepeats); slider.getData().set("repeats", repeats); //Write new data var result = "minRepeats: " + minRepeats + "
" + "maxRepeats: " + maxRepeats + "
" + "repeats: " + repeats + "
" + (repeatString + "
").repeat(repeats) ; promise.fulfill(result); }, 1000); return promise; }, animationDuration: 100, width: 600, events: { onLoad: function(event) { var slider = event.getSlider(); console.log(slider.getData().get("repeats")); //Read written data } } });
Opening of slider by the HTTP-method POST.
BX.SidePanel.Instance.open("/mypage.php", { options: { requestMethod: "post", requestParams: { // post-parameters action: "load", ids: [1, 2, 3], dictionary: { one: 1, two: 2 } } } });
Метод BX.SidePanel.Instance.bindAnchors
BX.SidePanel.Instance.bindAnchors( options )
The method registers handling rules for clicked links on a page.
Parameters
Method | Description | Available from version |
---|---|---|
options | Settings for link clicking handling mechanism.
| Object |
Other class methods
Method | Description | Available from version |
---|---|---|
BX.SidePanel.Instance.isOpen() | Returns true, if the slider is displayed on screen. | |
BX.SidePanel.Instance.close([immediately=false]) | Closes the current slider on the page. immediately {boolean}Close slider instantaneously, without animation. | |
BX.SidePanel.Instance.closeAll([immediately=false]) | Closes all sliders on the page. immediately {boolean} Close sliders instantaneously, without animation. | |
BX.SidePanel.Instance.destroy(url) | Eliminates slider on the page. url {string} Page address or deleted slider ID. | |
BX.SidePanel.Instance.getTopSlider() | Returns the current opened slider (instance of the [[link=6518345]BX.SidePanel.Slider[/link] class). | |
BX.SidePanel.Instance.getSlider(url) | Returns slider (instance of the [link=6518345]BX.SidePanel.Slider[/link] class) by the specified address or identifier. url {string} - Page address or slider ID. | |
BX.SidePanel.Instance.getSliderByWindow(window) | Returns the slider (instance of the [link=6518345]BX.SidePanel.Slider[/link] class) by the iframe window. window {Window} - Object of the iframe window. | |
BX.SidePanel.Instance.getOpenSliders() | Returns list of all opened sliders (array of [link=6518345]BX.SidePanel.Slider[/link] class instances). | |
BX.SidePanel.Instance.getLastOpenSlider() | Returns closed slider (instance of the [link=6518345]BX.SidePanel.Slider[/link] class). |
© «Bitrix24», 2001-2024