[Proto-Scripty] Re: Coming from jquery (be gentle)

2008-11-10 Thread Tobie Langel
You should be using event delegation like so: document.observe('click', function(event) { var element = event.findElement('ul.bopCategories li h3'); if (!element) return; element.next('div.bopCategoryDetails').toggle(); element.toggleClassName('expanded'); }); You don't need to wait for

[Proto-Scripty] Re: Coming from jquery (be gentle)

2008-11-10 Thread bluezehn
Wow this thread should be summarized somewhere as an intro to prototype in 5 minutes page! On Nov 10, 2:16 pm, Tobie Langel [EMAIL PROTECTED] wrote: You should be using event delegation like so: document.observe('click', function(event) {   var element = event.findElement('ul.bopCategories

[Proto-Scripty] Re: Coming from jquery (be gentle)

2008-10-03 Thread T.J. Crowder
Hello Kris, and welcome! When I first started with Prototype, I sat down and read through the API docs from front to back. It took about an hour (and I'm a slow reader), and was hugely useful -- so useful, in fact, that when I started reading this group (well, its predecessor) to gain further

[Proto-Scripty] Re: Coming from jquery (be gentle)

2008-10-03 Thread bluezehn
Between me and T.J's post you should be able to get something decent working now, plenty of code for you! On Oct 3, 10:38 am, bluezehn [EMAIL PROTECTED] wrote: So get that javascript out of the html and use observers. So the code you have so far is much better in prototype as this:

[Proto-Scripty] Re: Coming from jquery (be gentle)

2008-10-03 Thread Kris Northfield
Hi, Brilliant. Both answered a lot of questions and expanded my prototype knowledge ten fold. Thanks very much. Kris. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Prototype script.aculo.us group. To post to this

[Proto-Scripty] Re: Coming from jquery (be gentle)

2008-10-03 Thread bluezehn
So get that javascript out of the html and use observers. So the code you have so far is much better in prototype as this: h3Event/h3 div id=divvy2 Test test test test test test test test ets test test test test test /div !-- IN JAVASCRIPT --

[Proto-Scripty] Re: Coming from jquery (be gentle)

2008-10-03 Thread Jarkko Laine
I'll throw in a Low Pro [1] version as well: Event.addBehavior({ 'ul.bopCategories .bopCategoryDetails' : function() { this.hide(); }, 'ul.bopCategories li h3:click' : function(e) { elm = e.element(); elm.next('div.bopCategoryDetails').toggle();

[Proto-Scripty] Re: Coming from jquery (be gentle)

2008-10-03 Thread kangax
On Oct 3, 5:38 am, bluezehn [EMAIL PROTECTED] wrote: So get that javascript out of the html and use observers. So the code you have so far is much better in prototype as this: h3Event/h3         div id=divvy2         Test test test test test test test test ets test test test test test