-
Notifications
You must be signed in to change notification settings - Fork 1
.defaultDisplayStyle()
hlaCk edited this page Dec 21, 2018
·
1 revision
Get default css display value for element tag.
_z(selector).defaultDisplayStyle();
- _z to access UnderZ library.
- selector select element by selector to get default style. ( you can send DOM element or selector)
- defaultDisplayStyle method/action name.
Returns: CSS Display Property String
_z().defaultDisplayStyle( tagname );
- _z to access UnderZ library.
- defaultDisplayStyle method/action name.
- tagname Get default display style value for this tag. ( you CAN NOT send DOM element, must be HTML tagname)
Returns: CSS Display Property String
<button id="textdg" style="display: grid;">Display grid</button>
<button id="textdf" style="display: flex;">Display flex</button>
<button id="textdib" style="display: inline-block;">Display inline block</button>
<script>
// bind click event to all buttons
_z("button").click(function () {
alert( _z(this).defaultDisplayStyle() ); // default button css display is: inline-block
});
// get default CSS display value for div
alert( _z().defaultDisplayStyle( "div" ) ); // default button css display is: block
</script>Recommended: bind events in .ready() to execute the event when the document is fully loaded.