6 - Javascript related
There are a list of CSS class binded with jQuery
6.1 span of any width / height
class=span data-w=300px class=span data-w=30% data-h=100px6.2 confirm - js effect on click
Click here to confirm, class=confirm, data-confirm=msg to confirm
6.3 dollar / number - js effect on change
class=dollar, format input as dollar eg 1,234.56
class=number, format input as number eg 1,234.567
6.4 pop - popup a modal
Click here to pop up Example 2
6.5 open - open one child at a time
- 1- open
- This is the details of 1
- 2- wiki
-
Brief wiki of "open"
You have a list of siblines of eg divs one after another, click on one open the next and close all others
Code example
- 3- the third headline
- More text for the 3rd
6.6 tabs - open one tab at a time
- 1 - tabs
- 2 - wiki
- 3 - other
Here is some brief wiki of class="tabs"
There are exactly 2 kids inside tabs
The 1st kid is the headlines to click, add class="on" to the active one
The 2nd kid is the text of 1st kid, add class="on" to the active one
6.7 tree - click to open/close a tree menu
The tree look nested, however the code [div] not nested, instead they are siblines. The ids of the divs look like nested kids.
This is a demo of class="tree"
1. id = abc
2. id = xyz
2.1 id = xyz-123
2.1.1 id = xyz-123-cat ... some text
2.2.2 id = xyz-123-dog ... some text
2.2 id = xyz-888
2.2.1 id = xyz-888-cat ... some text
2.2.2 id = xyz-888-dog
6.8 show - click to open/close anything
class="show" data-src="target"; target can be anything eg html tag, id, class, etc
The following is a list of controllers, please click to see the effect
class="show" data-src="#showID" src=".showDemo" src="#showDemo b" defa next Im next
The following is a list of targets, which will demo talking to above controllers.
id="showID" class="showDemo" Im b inside #showDemo
show can also close parents -- click here to reset the box below:
close parent data-p="p" i.e box 4 data-p="pp" i.e box 3 data-p="ppp" i.e box 2 data-p="div.abc" i.e box 1
6.8 js-kid
class="js-kid" data-kid="css1 css2"
copy classes in data-kid to all it's kid elements
class="js-kid" data-src="src or int" data-css="css"
copy data-css (if no css then "on") to children(src), if src is int, then :nth() kid
6.9 formH
Imagine you have a horizontal form-group of label and input in each line:
You can use formH to push all class to each kid and kid.label and kid.input etc
Here is the result of above
If a form without label, it's more simple just use js-kid
And here is the result of above code:
6.10 pgno - pagination
6.10.1 - pgno with direct link eg a href="?page=2&key=var" (class=pgno + data-url and/or data-param)
And here is the result of above example
- First
- ...
- 18
- 19
- 20
- ...
- Last
And here is the result of above example
- First
- ...
- 18
- 19
- 20
- ...
- Last
6.10.2 - pgno on click to send a form (class=pgno + data-id)
And here is the result of above example
- First
- ...
- 18
- 19
- 20
- ...
- Last
6.11 youtube - shorthand for youtube videos
[div class="youtube"]youtube-id[/div] will become the following:
6.12 slide
6.13 ajax
6.13.1 ajax (default cmd = on change)
eg If you change the country to CN, it will get data from /api?country=CN and populate content for select name="state" accordingly
6.13.2 ajax (cmd = on click)
eg on click, it will get data from data-url, then update the html code for data-src accordingly
eg on click, it will get data from data-url, then update the html code for self if no data-src specified
6.14 file upload: input type="file" class="upload"
Dev note: .upload position seems buggy once you put it inside a cell, not not clickable, but position is misleading (still clickable, but hard to find where to click)
6.15 #backTop - click to scroll back to page top
6.16 lazy load img when screen visible
[img class="load-img" data-src="url-of-img"]
