mootools

How do I inject javascript to a page on IE 8?

Lets suppose that I have the following markup: <div id="placeHolder"> </div> and I have a javascript variable jsVar that contains some markup and some javascript. By using Mootools 1.1 I can inject the javascript content to the placeholder like this: $('placeHolder').setHTML(jsVar); This works in Firefox, Opera and even Safari and...

Not Throwing Errors in a JavaScript Library

On the front page for MooTools, it says: MooTools code respects strict standards and doesn't throw any warnings. I like MooTools, but having recently read The art of throwing JavaScript errors, I'm a bit confused as to why 'not throwing any warnings' is a feature. If a library doesn't tell you when there's an error (which may b...

How do jQuery do it's cross-domain ajax calls and how can I replicate em with mootools

hi ! in my eternal internal fight on whether to stay with mootools or jump to jQuery I've found on the jQuery documentation something that got my attention and this is that jQuery can ask for a JSON to a different domain, which is usually forbidden by the browser. I've seen some workarounds for cross-subdomain, but never cross-domain, ...

Onload set divs opacity to 50%

Okay, so I have a site running Joomla and it is using the mootools 1.11 framework. I've fudged together a working version of this using examples from the mootools 1.2 framework but cannot get the two to co-exist even with the compatibility layer, without breaking other modules in the Joomla site. Question I have a couple of divs with a ...

CSS selector for targeting only immediate children and not other identical descendants

I have nested sortable list that can have items dynamically added or removed and can be nested n-levels deep. On nesting, a new ul element is injected into whatever li element is selected to be the parent. The initial state of the list is something like the following: <ul id="parent"> <li id="One"><a href="" class="listLink"><span c...

JSONP and invalid label

Using mootools and JsonP I get "invalid label" error in Firefox Error console JsonP seems to work (I get the data correctly) {"jsondata":[{"title":"title1","link":"http://xxxx.xxx.xxx","thumbsrc":"http://xxxx.xxx.xxx/17_t.jpg" ,"description":".......","pubDate":"2009-03-09 06:26:00",},{"title":"title2","link":"http://xxxx.xxx.xxx","th...

Is there a jQuery TextboxList ?

Hi folks, Facebook have a great TextboxList component. This has just been ported (from scratch) into MooTools. Does anyone know if this exists in jQuery? edit: ahh! autocomplete was the keyword i was missing. cheers! ...

Algorithm for data filter

Can you suggest me an algorithm for filtering out data. I am using javascript and trying to write out a filter function which filters an array of data.I have an array of data and an array of filters, so in order to apply each filter on every data, I have written 2 for loops foreach(data) { foreach(filter) { check data with filt...

Convert 4 lines of Jquery to Mootools

Hi, The following lines of code do two things. The first two lines add classes to the siblings immediately before and after an element with a given id (in this case a UL with id "nav") The last two lines add the classes first and last to the first and last sibling elements whose parent has the id "nav". This is jquery. How would I ach...

How can I add a hover class to an element?

On my CSS I have: li.sort:hover {color: #F00;} All my LI elements under the 'sort' class function properly when the DOM is ready. If I create a new LI element (using mootools el.addClass(classname)) I can set the base class, but can't figure out how to add a "hover" class to it. Any ideas? d. ...

How different is Ext JS from others like jQuery and Mootools

When looking at Ext JS, I don't get the feeling that it's meant for the same things as jQuery and Mootools. Whilst jQuery and Mootools help with the general workings of a site, Ext JS seems to be focussed on tables and storing data, plus manipulating it. So, is this observation correct, or is Ext Js fit for the same work as jQuery and ...

How to get the name of a Mootools class from within

I'd like to get at the variable name of class. var Poop = new Class({ getClassName: function() { return arguments.callee._owner.name; } }); var a = new Poop(); a.getClassName(); //want 'Poop' I'm making that will be implemented into other classes, and I'd like to build a SQL query that uses the class name (pluralized) ...

ie6 background image png AlphaImageLoader issue after load with mootools 1.11

hi, I'm trying to render a .png background image in ie6 after a mootools onclick event which changes the background image of a logo div. here is the relevant code as it is just now- if(!window.ie6){ $('logo').setStyle('background-image', imagePath); }else{ $('logo').setStyles({ filter: "progid:DXImageTransform.Microsoft.Al...

Are there any guides on converting between Javascript frameworks?

I have a date picker library written for MooTools that I want to port to Prototype. It's looking to be a long arduous task and I'm wondering if anyone has seen or written guides on the differences between the two. A translation dictionary of sorts, where I can look up a Moo function and see the prototype equivalent, or vise-versa. The...

body background-image change with fade effect mootools

Hi, I'm changing my background-image css property using Mootools: $(document.body).setStyle('background-image','url(' + pBackground + ')'); And it's its working, but how can a make one fade effect between picture change? Thanks, Pedro ...

Instantiate a Class dynamically via variable

How can I instantiate a class by throwing in a variable name? Consider this method inside a class: animate: function(el, build) { console.log(build.effect); var animationClass = new build.effect(el,build); }, Build is an object containing lots of stuff, but most importantly an "effect". This effect is the name o...

Exploring Implements/Extends in MooTools

I'm working on some effects and things to get a handle on Classes/Implements/Extends. The examples here are for the base classes (MooSlidesFx, MooSlidesFx.Elements) from which to create many effects with a project I'm working on, and two child class (MooSlidesFx.Fade, MooSlidesEffects.Elements.Fade) that actually do something. http://pa...

Convert Mootools Element Drag to Prototype

I currently use the below code to be able to drag an element around inside a div container (this is important, it can't just be dragged around anywhere eon the page). I use mootools to accomplish this, but I am converting everything to use prototype, but I can't figure out how to get this to work with prototype. window.addEvent('do...

Do javascript developers need to know jquery?

If you were to hire a javascript developer would you expect them to know jquery? I just started using stack overflow this week and knew that jquery led the pack, but didn't realize the extent of it until I noticed that MooTools (my favorite) has 59 questions while jquery has over 4000. (of course, a good statistician could attribute jqu...

Programmatically determine DPI via the browser?

Hi all. I would like to programmaticaly determine the DPI of a user's display in order to show a web page at a precise number of units (centimeters/inches). I know it a weird request: it's for a visualization research project and it's kind of a control. We currently do it by having the user place a credit card to the screen and match a r...