Recently on the move end of the project, so much of the use of ' lightweight zepto.js, now the problem is, I need to show-hide a div, generally to determine whether this div is visible, then show or hide, test a page is visible or invisible, generally use $ (' div '). Is (: Visible), however Zepto.js does not support: visible, so it must be judged in a different way:
(1) can check the CSS properties of the display: CSS ("display") = = "Block"
(2) can check visible: visible/Hidden: CSS ("visibility") = = "visible"
Examples are as follows:
Evaluation Hide-Show
$ ('. Comment-btn '). Click (function () {
if ($ ('. Hidecomment '). CSS ("display") = = "None") {
$ ('. Hidecomment '). Show ();
$ ('. Btnarrow '). Removeclass (' btnarrowtop ');
$ ('. Btnarrow '). addclass (' Btnarrowdown ');
}else if ($ ('. Hidecomment '). CSS ("display") = = "Block") {
$ ('. Hidecomment '). Hide ();
$ ('. Btnarrow '). addclass (' btnarrowtop ');
$ ('. Btnarrow '). Removeclass (' Btnarrowdown ');
}
});
In a mobile-end project, there are many things that are different from computer pages,
One, such as tap () and click () (300ms latency problem on mobile phone click events)
Second, such as: when the user finger on the mobile device on the screen sliding will trigger the touch event, Touchstart (), Touchmove (), Touchend () and so on.
Third, about the file upload control <input type= "File" > Accept properties:
<!– Select photos –>
<input type=file accept= "image/*" >
<!– Select Video –>
<input type=file accept= "video/*" >
Four, Android users click on a link, there will be a border or translucent gray mask, different manufacturers to define the amount of the effect is not the same, you can set the-webkit-tap-highlight-color alpha value of 0 to remove some of the machine from the effect of the band
a{
-webkit-tap-highlight-color:rgba (0,0,0,0);
Outline:none;
Text-decoration:none;
}
Five, our common select control under the iOS system, with the rolling effect, and the Android system does not have that effect
VI, the use of jquery is really convenient, such as to control the display of div and hide, a word is done, please see the following instructions.
$ ("#id"). Show () indicates Display:block,
$ ("#id"). Hide () indicates display:none;
$ ("#id"). Toggle () Toggles the visible state of the element. If the element is visible, switch to hidden, and if the element is hidden, toggle to visible.
$ ("#id"). CSS (' Display ', ' none ');
$ ("#id"). CSS (' Display ', ' block ');
Or
$ ("#id") [0].style.display = ' none ';