Template Examples - Toggle Switch"
From Documentation
Robertwenzel (talk | contribs) |
Robertwenzel (talk | contribs) |
||
Line 15: | Line 15: | ||
<source lang="html"> | <source lang="html"> | ||
− | |||
− | |||
− | |||
− | |||
− | |||
<body> | <body> | ||
... | ... | ||
− | <div> | + | <div class="switch"> |
<input id="cmn-toggle-1" class="cmn-toggle cmn-toggle-round" type="checkbox"> | <input id="cmn-toggle-1" class="cmn-toggle cmn-toggle-round" type="checkbox"> | ||
<label for="cmn-toggle-1"></label> | <label for="cmn-toggle-1"></label> | ||
Line 34: | Line 29: | ||
<source lang="xml"> | <source lang="xml"> | ||
− | |||
− | |||
− | |||
<zk xmlns:x="xhtml"> | <zk xmlns:x="xhtml"> | ||
− | <div><!-- zk div --> | + | <div sclass="settings"><!-- zk div --> |
− | <x:div><!-- xhtml div --> | + | ... |
+ | <x:div class="switch"><!-- xhtml div --> | ||
<x:input id="cmn-toggle-1" class="cmn-toggle cmn-toggle-round" type="checkbox"/> | <x:input id="cmn-toggle-1" class="cmn-toggle cmn-toggle-round" type="checkbox"/> | ||
<x:label for="cmn-toggle-1"/> | <x:label for="cmn-toggle-1"/> |
Revision as of 08:43, 18 May 2017
Author
Robert Wenzel, Engineer, Potix Corporation
Robert Wenzel, Engineer, Potix Corporation
Date
May 2017
May 2017
Version
ZK 8.0
ZK 8.0
Introduction
The web is full of html5/css based layout examples ... e.g. this: http://callmenick.com/post/css-toggle-switch-examples
Using the original markup and styles
A very basic way to integrate a 3rd party layout is to simply re-use the markup with xhtml components.
<body>
...
<div class="switch">
<input id="cmn-toggle-1" class="cmn-toggle cmn-toggle-round" type="checkbox">
<label for="cmn-toggle-1"></label>
</div>
...
</body>
ZK's xhtml component set can be combined with ZUL components - using the xhtml namespace LINKME.
<zk xmlns:x="xhtml">
<div sclass="settings"><!-- zk div -->
...
<x:div class="switch"><!-- xhtml div -->
<x:input id="cmn-toggle-1" class="cmn-toggle cmn-toggle-round" type="checkbox"/>
<x:label for="cmn-toggle-1"/>
</x:div>
...
</div>
</zk>
Streamlining with <template>
Customize ZK's <checkbox> component
Summary
Example Sources
The code examples are available on github in the zk-template-examples repository
- zul files: https://github.com/zkoss-demo/zk-template-examples/tree/master/src/main/webapp/css-toggle-switch
- java classes: https://github.com/zkoss-demo/zk-template-examples/tree/master/src/main/java/zk/example/template/stepbar
Running the Example
Clone the repo
git clone [email protected]:zkoss-demo/zk-template-examples.git
The example war file can be built using the gradle-wrapper (on windows simply omit the prefix './'):
./gradlew war
Execute using jetty:
./gradlew appRun
Then access the example http://localhost:8080/zk-template-examples/css-toggle-switch/
Comments
Copyright © Potix Corporation. This article is licensed under GNU Free Documentation License. |