Using Dojo's behavior functionality to recognize scrolling events -
i'm not able figure out how assign function scroll event in dojo. have seen other post using dojo's connect, i've been unable work, , if could, project's using behaviours as possible, i'm trying work first...
the puzzling thing me, i've looked around on dojo's website bit, , references i've seen scroll events mention them aside. on http://dojotoolkit.org/reference-guide/1.9/quickstart/events.html#connecting-to-a-dom-event example, there's list of events can connect-ed to, , scroll isn't on them. mouse wheel + down are, not cover possible actions might lead scroll occurring.
i've used jquery's scroll event before, , nice , simple. fact i'm having trouble figuring out scroll event in dojo bothers me little.
this i've tried:
var mybehavior = { window : { scroll: function(e) { console.log("i'm scrolling"); } } }; behavior.add(mybehavior); behavior.apply();
that loads without problems, scrolling doesn't give me console logging message.
i've tried
dojo.connect(window,'scroll',this,function() { console.log("scrolling away"); })
which pretty got linked post, , didn't console logging message either. i'm starting wonder if i'm missing key library?
the ones have required think more necessary: - dojo/_base/lang - dojo/query - dojo/_base/event - dojo/on - dojo/behaviour - dojo/window
does have suggestion how start registering these scrolling events in dojo? thank you
i created jsfiddle demoing usage of dojo/on
window scroll event.
html:
<body> <div style="height:1000px;"> bacon ipsum dolor sit amet meatball drumstick jerky strip steak kielbasa shoulder, short ribs filet mignon prosciutto swine meatloaf ribeye tongue turkey andouille. hamburger bacon fatback, short ribs pork loin cow chicken. capicola venison andouille kielbasa cow. short ribs kevin rump meatloaf jowl prosciutto leberkas. pork belly shankle doner spare ribs, rump pork chop sausage tenderloin. brisket swine pig, fatback beef ribs shank tri-tip flank ham venison strip steak filet mignon rump frankfurter ribeye. fatback turkey sausage tongue doner strip steak boudin shoulder chuck beef ribs chicken bacon brisket. turkey biltong bacon cow short ribs fatback. sausage brisket pork loin corned beef pork chop shank jowl capicola leberkas strip steak prosciutto beef tri-tip. jowl frankfurter beef ribs, swine tail doner tri-tip t-bone. jowl pork loin sausage venison salami shankle kevin strip steak boudin doner bresaola filet mignon ham drumstick ribeye. turkey pork belly kielbasa ribeye salami, strip steak ham hock jerky shoulder tenderloin shankle spare ribs beef ribs filet mignon. short loin fatback kevin, biltong tail shoulder ball tip. pork loin t-bone ground round tongue turducken tail shoulder chicken sausage pancetta hamburger, kielbasa tri-tip strip steak short ribs. pork chop prosciutto tri-tip, jerky brisket leberkas andouille ham hock tongue shoulder fatback meatball. pig short loin beef spare ribs, rump meatball short ribs doner kielbasa ball tip swine bacon kevin. hamburger tail frankfurter ham hock tongue, jerky pork belly bacon shank salami prosciutto ground round doner jowl turducken. prosciutto pork chop drumstick ham hock meatloaf. drumstick ham hock ball tip salami cow. shankle hamburger sirloin sausage tongue pork chop flank, doner pig tri-tip pancetta shoulder. venison ball tip beef biltong tail, corned beef pastrami andouille frankfurter kevin pork meatball chicken. ground round shankle sirloin capicola kevin spare ribs ham hock fatback strip steak short ribs leberkas. venison flank tenderloin tri-tip salami pork capicola drumstick brisket short ribs sirloin chuck boudin kielbasa cow. short ribs corned beef shankle meatball, tri-tip t-bone sirloin cow leberkas chicken jerky. short loin drumstick pork loin biltong sausage prosciutto rump flank hamburger pork chop meatball capicola turkey leberkas cow. andouille ribeye boudin ham chicken. t-bone rump meatball drumstick hamburger pork chop, flank sausage tongue andouille fatback. lorem ipsum text long little meatier? give our generator try… it’s tasty! </div> </body>
js:
require(['dojo/on','dojo/domready!'],function(on,domreadyplugin){ on(window,'scroll',function(evt){ console.log(evt); }); });
the result print console every time user scrolls in window. if continue have issues it, post more code can bottom of it, should simple thing do.
Comments
Post a Comment