NOTE: only one instance of a modal can be rendered a time because it makes managing the modal easier
This is how to setup a basic modal
<a data-toggle-modal-default href="#modal-demo">Modal Toggle</a>
<div class="modal modal-default" id="modal-demo">
<!-- Put ya content here -->
</div>on modal element add class modal-{MODE} to signify what subcomponent or mode the modal will render as or modal-default
on [data-toggle-modal] suffix it to -{MODE} to partner it with its matching modal
More on modes in a bit
You can also modify padding using modal-expanded (for larger padding), modal-compact (for smaller padding)
Elements with this attribute looks for a .modal to append its content to an actual poppo
This one looks for the href of the boi
<a href="#bitch-ass-modal" data-toggle-modal-default>Open a bitch</a>
<div id="bitch-ass-modal" class="modal modal-default">
Sup mofos, I'm an modal content
</div>Another way but [data-toggle-modal-{MODE}] looks for a data-href to go to because there's no href
<span data-href="#bitch-ass-modal" data-toggle-modal-default>Open a bitch</span>
<div id="bitch-ass-modal" class="modal modal-default">
Sup mofos, I'm an modal content
</div>Another way but [data-toggle-modal-{MODE}] looks for a sibling because there's no href or data-href
<div class="container">
<span data-toggle-modal-default>Open a bitch</span>
<div class="modal modal-default">Sup mofos, I'm an modal content</div>
</div>Unlike just [data-toggle-modal-{MODE}], these attributes are more specific whether to close, or to open the modal
These attributes can be embedded to either the [data-toggle-modal-{MODE}], or the .modal itself, but will prioritize the attributes embedded on [data-toggle-modal-{MODE}]
Defaults to true
Whether or not to have the modal change the location.hash when enabled and then disabled
<a data-modal-width="800px" href="#modal-demo"
>Modal boi with max width <i class="symbol symbol-search"></i
></a>
<div class="modal modal-default" id="modal-demo">
<!-- content heeeere -->
</div>Defaults to ''
Title to add a modal. Adding this will add a header to ya modal
<a data-modal-title="Look at this bitchboy going modal and shit" href="#modal-demo"
>Modal boi with titlet <i class="symbol symbol-search"></i
></a>
<div class="modal modal-default" id="modal-demo">
<!-- content heeeere -->
</div>Defaults to true
Adds a close button to the modal
<a data-toggle-modal-default data-modal-close="true" href="#modal-demo"
>Modal boi close butt <i class="symbol symbol-search"></i
></a>
<div class="modal modal-default" id="modal-demo">
<!-- content heeeere -->
</div>Defaults to true
Whether or not to allow clicking on the overlay to close the modal
<a data-modal-disable-overlay="true" href="#modal-demo"
>Modal boi but when you click on the backdrop it dies
<i class="symbol symbol-search"></i
></a>
<div class="modal modal-default" id="modal-demo">
<!-- content heeeere -->
</div>Defaults to null
Whether or not to add a max-width to the modal. The modal is styled to be responsive. adding a max width can add limit to width
<a data-modal-width="800px" href="#modal-demo"
>Modal boi with max width <i class="symbol symbol-search"></i
></a>
<div class="modal modal-default" id="modal-demo">
<!-- content heeeere -->
</div>Defaults to null
Function to run after the modal is ready but before it's displays
<a
data-toggle-modal-default
data-modal-callback="fuckinModalCallback()"
href="#modal-demo"
>Modal boi with a callback</a
>
<script>
var fuckinModalCallback = function () {
//js code to run here
console.log('RUN');
};
</script>Defaults to null
classes to add to the generated modal or #fw-modal
<a data-toggle-modal-default data-modal-classes="theme-inverse" href="#modal-demo"
>Modal boi with classes</a
>Defaults to null
classes to add to the generated .modal-ui-close
<a data-toggle-modal-default data-modal-close-classes="theme-inverse" href="#modal-demo"
>Modal boi with classes</a
>Defaults to false
centers modal on the screen. won't work for boards because ya boi is already stretching top to bottom why would you ?? nani??
<a data-toggle-modal-default data-modal-center-y="true" href="#modal-demo"
>Modal gonna be centered vertically</a
>
## Board Specific Attributes/Settings ### **`data-close-align`** - `args.align` Defaults
to `right` sets where the board mofal is aligned to ### **`data-close-resize`** -
`args.resize` Defaults to `false` enable resize feature ###
**`data-close-resize-classes`** - `args.resizeClasses` Defaults to `null` classes to add
to resize btn ### All together now ```html
<a
data-toggle-modal-default
data-modal-close="false"
data-modal-disable-overlay="false"
data-modal-width="800px"
data-modal-title="Bitch"
href="#modal-demo"
>Modal boi with max width and no close butt <i class="symbol symbol-search"></i
></a>
<div class="modal modal-default" id="modal-demo">
<!-- content heeeere -->
</div>NOTE add .body-no-scroll to the body tag so scrolling doesnt conflict with the modal's scrolling capability
lol good luck
If a url's hash location matches an element with that id and it has an valid modal-{MODE} class and, the modal will automatically open it
to disable this write ya script
(function (fw) {
fw.Settings.modify('initializeModal', false);
})(fw);NOTE: this is useless if fw.settings.get('dynamicHash') is set to false
Make a new boi by going const modal = new fw.Modal(element,triggerer,args)
element is the element itself. if blank, does nothing
triggerer is the element that triggers the element. if left blank, it doesnt mess with any data-toggle-elements
args is the settings above available
//defaults
{
changeHash: true,
title: '',
close: true,
disableOverlay: true,
width: null,
callback: null,
classes: '',
closeClasses: '',
//board mode specific
align: 'left',
resize: false,
resizeClasses: ''
}duh
element is the element triggered. if left blank, this defaults to the element attached to the instance
updates utility button classes to match the state of the viewport or whatever the fuck thats going on that ya boi depends on
element is the element triggered. if left blank, this defaults to currently active modal matching the current instance's mode
updates utility button classes to match the state of the viewport or whatever the fuck thats going on that ya boi depends on
width is the width property u want the modal to be set at
destroys any active uis for the element
element is the element triggered. if left blank, this defaults to currently active modal matching the current instance's mode
returns obj with active modals on screen
mode is the mode of the modal u wanna get. if left blank, this returns all instances of modal modes
returns obj with component arg defaults
initializes all event listeners
returns obj with component set args
-
click_fw_modal- happens ontriggerer -
hashchange_fw_modal- happens onwindowon hashchange -
before_create_fw_modal- happens onelementbefore create -
create_fw_modal- happens onelementwhen create -
after_create_fw_modal- happens onelementafter create -
before_destroy_fw_modal- happens onelementbefore destroy -
destroy_fw_modal- happens onelementwhen destroy -
after_destroy_fw_modal- happens onelementafter destroy -
before_update_fw_modal- happens onelementbefore update -
update_fw_modal- happens onelementwhen update -
after_update_fw_modal- happens onelementafter update -
before_resize_fw_modal- happens onelementbefore resize -
resize_fw_modal- happens onelementwhen resize -
after_resize_fw_modal- happens onelementafter resize
These are valid names for modes that will setup the styles and functionalities valid for the modal that depends on that mode i cant make english correctly right now but you get the idea
defaultboardfull(coming soon) maybe
halat ta igwa pa akong ilalaag igdi
