Perkerson: Show us what you’re doing and we can give you pointers.
Bustillos: I ca not use scroll listener on my app its too much of memory/cpu consuming
Pettus: The problem isnt’ the listener in this case.
Bedoka: The problem is you keep calling $
Mormann: And calculating the height.
Kallin: Also, what is getDo***entHeight doing?
Spice: So what are u suggesting
Wiesel: Basically, you need to call $window once and store that in a var before your handler, then use that var instead of $window
Kullas: How do you have an event listener to an element that is added to the page AFTER load
Yaple: You don’t – use event delegation instead.
Deichman: See http://learn.jquery.com/events/event-delegation/ and http://api.jquery.com/on/#direct-and-delegated-events
Henrie: A simple quick lil example snippet would have definitely suffice.
Neagle: That’s not how we roll here :
Gravert: When did they add that beta sticker in there 😀
Fairly: Plus understanding the concept is pretty important.
Balay: I’d say it’s very important
Nadine: Understanding what you’re doing, not the beta sticker 😀
Golab: I see a bunch of teachers who are great at copy and paste i see. Like stackoverflow. Quick to direct you to another link then just give a simple response. Some people are visual learners, to be honest. but nvm ill look
Coor: There are code examples in those links.
Stoviak: The basic gist is that you bind to a parent element that DOES exist on pageload, and p*** a second arg to .on that’s a selector for the element you want, which properly sets context inside the function.
Spinar: Also, for what it’s worth, if you’re a visual learner and still struggling, make a fiddle.
Nathanson: Hi guys, im using scrollspy to detect user position on screen and based on that im adding some cl***es to navigation. What i want to do is to take data-attribute from element and add that as a cl*** using .addCl***. Scrollspy takes elements ID but i need data-attribute instead of ID. Here is pastie http://pastie.org/10410581
Picknell: JQuery11020384325254832883_1441917550555 is not a function
Dorich: It doesn’t happen often
Brentson: Is async: false in jquery jsonp important? it’s because sometimes we get js exception error like Uncaught TypeError: jQuery110203843463684832883_144196799555 is not a function
Mattila: That makes the request synchronous. should try to avoid it if at all possible
Billotte: Hi guys, im using scrollspy to detect user position on screen and based on that im adding some cl***es to navigation. What i want to do is to take data-attribute from element and add that as a cl*** using .addCl***. Scrollspy takes elements ID but i need data-attribute instead of ID. Here is pastie http://pastie.org/10410581
Dure: So you mean $”.navigation”.addCl***element.id; you want the data-something instead of the ID?
Meyerowitz: Robertmaxrees: correct
Bromfield: Robertmaxrees: jQuery.data jQuery API Do***entation → https://api.jquery.com/jquery.data/
Mangieri: Robertmaxrees: thanks, i tried this $”.navigation”.addCl***element.data “color” ; but im getting error undefined t.data
Mondelli: Right – .data is a jquery method.
Albea: You’ll need to wrap the element in jquery first.
Juliar: Any hint how to do that
Matrone: The docs show you how pretty clearly.
Menden: Robertmaxrees: $”.navigation”.addCl***$element.data “color” ; looks weird but it works ;
Trancoso: I’d store that in a var first.
Law: Var theColor = $element.data’color’; $’.navigation’.addCl***theColor;
Donten: Thanks, its cleaner way