Just contact AppFrameWork, this want to try to do something to play, but did not expect to be stuck on the drawer.
Question one: Obviously is push, how to come out is cover?
Drawer plug-in has 3 effects, push,cover,reveal. But I used the push but there was a cover effect.
Code for the button:
<a id= "Mainnavbtn" href= "#" class= "button" onclick= "$.afui.drawer.show (' #mainNav ', ' left ', ' push ')" >left push </a>
①①①②②②②
Question two: Click ② Area () side menu is not turned off
General app, click ② area, side menu should be put away, the official demo Click can put away, my why not?
The expected effect should look like this: then actually it is:
Question conjecture:
A) Is it possible that you have bound the closed event yourself?
The appframework is closed with $.drawer.hide (). It should be possible to trigger the binding of elements within the ② zone to a Click/tap event.
But to view the official demo code, in addition to the necessary several JS files, and did not find a separate JS file, indicating that this feature is not unique.
Guess wrong!
Second, if the first one is not, then it must be the HTML structure of the problem.
The way to solve:
First ran to the official website search API but found this write ... And there's no egg to use. Simply introduce the use of $.drawer.show () and $.drawer.hide ().
PS: In the official website (http://app-framework-software.intel.com/components.php) about the icon of the demo is still wrong ...
and online about appframework information is relatively few, more related to the article is that he clicked side menu did not close (that is, click on the ① area, and ①
The zone is not closed. I was clicking on the ② area, the ① area was not closed, and finally his solution was to bind $.drawer.hide () in side menu.
is not the problem that I have to solve.
Finally used the most clumsy method, delete the code ...
The original official demo in the code is more, in order to find the problem, each of the insignificant code to delete ... (In fact, the deletion is quite fast), the results of the official demo
I was playing like this ... All the lights are erased.
Original Official Demo: Now the official demo:
Finally found ... originally my Nav did not write in the view inside!!! (already crying in the toilet)
In fact, in the beginning to think about this is not the reason, but the official demo is too long, I looked at two times that the Nav should be written out of view.
So the final correct wording should be this:
<div class= "View" >
<div class= "pages" >......</div>
<nav class= "left" >......</nav>
......
</div>
Error wording:
<div class= "View" >
<div class= "pages" >......</div>
......
</div>
<nav class= "left" >......</nav>
After the settlement of the thinking:
If not appframework, how should I implement the Click ② area to close it?
As a novice, there are two solutions that can be thought of:
A) build a mask layer, let it overwrite the ② area, and then bind a click event to the Mask layer to trigger $.drawer.hide ()
This idea is the simplest, one more div, one binding event. This method was tried before doing something.
II) bind $.drawer.hide () to the outermost bounding box of the ② area
This method may seem to work here, but if the ① area is above the ② area, that is:
Then when clicking on the ① area, it is easy to cause the click to penetrate, before using the zepto when there is this problem, Fastclick has not tried.
Three) bind all child elements in the ② Zone $.drawer.hide ()
This is a problem to think about ... I haven't tried it.
There are different of course want to know the best, a more div and a binding event (in fact, there should be a few, after all, there is a need to trigger the mask layer appears, disappeared events);
The second one does not require changes to the HTML structure, but it is possible to have a click-through problem. The third one doesn't change the structure of HTML, but it's tied up so much
..., because I haven't learned how to test the performance, so I have no conclusion which is good or bad at the end.
Finally, the spirit of learning to view the Af.drawer.js (that is, appframework implementation of drawer code), found that AppFrameWork adopted a third
The ② method, which is a child element within a zone that is bound. The code is as follows:
SetTimeout (function () {
$ (Currel). Closest (". View"). Children (). Filter (": Not (NAV): Not (aside)"). On ("Touchstart", Self.autohidecheck);
});
Currel is the NAV. See this also understand why I clicked view cannot be closed, because closet (". View") looks up the top of the view, and my Nav
It is not written in the view, so nature is not bound to the closed event.
Then the question comes again ...
In the experiment suddenly found a bug, when a view has two nav, if the first Nav has not been closed to click to let the second NAV display, then
The second nav showed a problem. Such as:
It can be found that the effect of reveal has become cover effect, this problem is also in the official demo.
Sighted I found the whole animation process to be like this:
Click left Push---nav1 with the Push effect appearing correctly, click Left Reveal, Nav1 normal close-up nav2 to Reveal effect appears normally
NAV2 is still there but pages are closed to the left.
debugging found that when Nav slid out, the right side of pages would add a class:slide-left-out (which is the final display, adding class:animation-active during the animation slide)
However, in the case of bugs, pages does not have a slide-left-out class, so pages are not expected to be on the right.
Late at night, continue tomorrow.
AppFrameWork (Jqmobi) Why my drawer can't shut it down.