javascript - clicking items inside a famo.us scrollview -


i have scrollview number of images.

events working such scrollview can dragged around.

i want able click on single image detail view used a:

surface.on 'click', => @parent.navto('detail') 

however, has effect if click image when scrolling above event fire.

i guess whole reason mobile browsers have 300ms delay - tell if you're clicking or dragging. famous have other events listen for?

in inputs/fastclick.js see 'touchstart' 'touchmove' , 'touchend'

do have track if drag motion happened, in our own code, or famous engine assist this?

fwiw i'm using genericsync pipe events around, , make view work on desktop.

constructor: (@parentview, @data) ->   scrolldir = 1   # 0 horiz, 1 vertical   super({     direction: scrolldir     paginated: true     pagestopspeed: 5   })    @addcontent()   @mousesync   = new famous.inputs.mousesync({direction: scrolldir})   @mousesync.pipe(this)  addcontent: () ->    comics = comics.find()   surfaces = []   @sequencefrom(surfaces)    item in comics.fetch()     div = document.createelement('div')     comp = ui.renderwithdata(template.comiccover, item)     ui.insert(comp, div)      surface = new famous.core.surface({       content: div       size: [undefined, 400]       properties:         backgroundcolor: "#eff"     })     surfaces.push(surface)     surface.pipe(this)     surface.on 'click', => @parentview.navto('comicpages')      # surface.pipe(@mousesync)    return @surface 

i have encountered similar issue. around it, track when scrollview scrolling , ensure not scrolling on click.

here code add.. hope helps!

# in constructor  this.sync.on 'update',  () => @scrolling = true this.sync.on 'end',     () => @scrolling = false  # in addcontent  surface.on 'click', () =>     if !@scrolling         @parentview.navto('comicpages') 

Comments

Popular posts from this blog

javascript - RequestAnimationFrame not working when exiting fullscreen switching space on Safari -

Python ctypes access violation with const pointer arguments -