greetings all,
i am looking for some help converting jquery code to mootools. just to let you know i am not that well versed in jquery or mootools. so here goes. jquery code in question: [code] $("#numbers li").click(function() { var clickednum = $(this).html() * - $('#slider').width() + $('#slider').width(); $('#slider ul').animate({ left: clickednum }, 400, 'swing', function() { }); $('.activenum').removeClass('activenum'); $(this).addClass('activenum'); decount = $(this).html(); window.location.hash = $(this).html(); }); [/code] my attempt at mootools: [code] $$('#numbers li').addEvent('click', function() { var clickednum = - this.get('html') * $$('#slider').getWidth() + $$('#slider').getWidth(); $$('#slider ul').setStyle('margin-left', clickednum); $$('.slider_content h2').set('text', clickednum); $$('.activenum').removeClass('activenum'); this.addClass('activenum'); decount = this.get('html').toInt(); window.location.hash = this.get('html').toInt(); }); [/code] its not perfect but in theory should at very least give me the same functionality as jquery (without animated transition). problem #1: [code]var clickednum = - this.get('html') * $$('#slider').getWidth() + $$('#slider').getWidth();[/code] does not produce desired result. in other words if: $$('#slider').getWidth() = 640px $$('#numbers li') - will have numbers ranging from 1 to infinity (incrementing for every list item in unordered list) so for instance if [code]this.get('html')[/code] hapens to be the first li. then the above should translate to [code]var clickednum = - 1 * 640 + 640;[/code] and result in zero. however i get -640640 as the result via [code]$$('.slider_content h2').set('text', clickednum);[/code]. question #1: what am i doing wrong on these lines? [code] var clickednum = - this.get('html') * $$('#slider').getWidth() + $$('#slider').getWidth(); $$('#slider ul').setStyle('margin-left', clickednum); [/code] problem #2: how to do mootool version of this [code]$('#slider ul').animate({ left: clickednum }, 400, 'swing', function() { });[/code]? i've tried a few ways of using morph() but it didn't work for me. why? i don't know. ps: in case you wonder why i need to go from jquery to mootools is because of joomla site i am working on. despite my efforts to make both libraries work at the same time the result is not satisfactory. so my last resort is to convert jquery into mootools. any help is much appreciated. thanks your time, iiminov