A
A
Anna Bakurova2014-04-24 15:09:01
JavaScript
Anna Bakurova, 2014-04-24 15:09:01

How to create touch site navigation for touch devices?

On the test.cuberto.ru/libris/index.html# site, it is necessary to implement touch navigation (now only scrolling and tabs work), the navigation should be something like this:
If more than $(window).height()/2 is scrolled, then we scroll to the next . block, if not, then go back. A prerequisite is that it should only be on touch and mousemove in no way, since this should not happen on non-sensors.
I have already seen many sites, but there is a touch with a mouse. If anyone has seen articles on how to make such functionality or seen such sites, then throw it, maybe someone has the code already ready without anything superfluous, then even better. This is the first time I've encountered this, so it's hard to figure it out. You can send an example to [email protected]
Example test.cuberto.ru/cub2014/index_r.php#work(you can only view what I talked about on the ipad)

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
iDevArtem, 2014-04-24
@Libris

Alternatively, add first:

var isTouch = ('ontouchstart' in window || (window.DocumentTouch && document instanceof DocumentTouch)) ? true : false,
    pushstart = isTouch ? "touchstart" : "mousedown",
    pushend = isTouch ? "touchend" : "mouseup";

and instead
of this:
$(".content").bind(pushend, function(e){ ... }

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question