javascript - Control dragging event to move to specific div -


lets have simple html sctructure:

<header>     <title>test</title> </header> <body>     <div class="section" id="section-1"></div>     <div class="section" id="section-2"></div>     <div class="section" id="section-3"></div> </body> 

... , css style:

.section{     float: left;     width: 100%;     height: 600px; }  #section-1{ background: red; } #section-2{ background: green; } #section-3{ background: blue; } 

here can check working: http://jsfiddle.net/zmv2r/

i'm trying find way user can dragging page vertically, and, depending user is, go specific div.

1 - if user drag down in red div, scroll moves next one: green div. if user drag in red div, continues in div.

2 - if user drag down in green div, scroll moves next one: blue div. if user drag in green div, scroll moves previous one: red div.

3 - if user drag down in blu div, continues in div. if user drag in blue div, scroll moves previous one: green div.

i don't know can start doing these actions. think maybe jquery ui can this.

thank you.

i start here

https://developer.mozilla.org/en-us/docs/web/guide/dom/events/touch_events?redirectlocale=en-us&redirectslug=web%2fguide%2ftouch_events

something like

function handlestart(evt) { evt.preventdefault(); var el = document.getelementsbytagname("canvas")[0]; var ctx = el.getcontext("2d"); var touches = evt.changedtouches;  (var i=0; i<touches.length; i++) {   ongoingtouches.push(touches[i]);   var color = colorfortouch(touches[i]);   ctx.fillstyle = color;   ctx.fillrect(touches[i].pagex-2, touches[i].pagey-2, 4, 4); 

} }


Comments

Popular posts from this blog

blackberry 10 - how to add multiple markers on the google map just by url? -

php - guestbook returning database data to flash -

delphi - Dynamic file type icon -