Element.zboing()
Snippets are small pieces of code that do not fit in the UvumiTools plugin category. Please note that each of these semi-useful functions requires Mootools 1.2.
Inspired by the red ball from the old moofx site. It pretty much takes the same idea, but written for mootools 1.2 and as an Element function. Like the heart beating effect, it's not very useful but looks cool on a logo or similar graphic element.
if(parent != $(document.body) && parent.getStyle('position')=='static'){
var position = this.getStyle('position');
if(position=='static'){
position = 'relative';
if(Browser.Engine.trident || Browser.Engine.presto){
var coords = this.getPosition(parent);
if(position == 'relative'){
coords.y -= parent.getStyle('paddingTop').toInt();
this.setStyle('cursor','move').store('position',coords).set('morph',{
this.element.get('morph').start({
left:position.x
return this;
Usage:
Demo: Try to grab and release the ball. Woot.
Note: if you're going to use this effect on an image, like here, Internet Explorer is going to try to ruin you life, again, by activating its special dragging thingy meant to allow you set the picture directly as your desktop wallpaper or something like that.
To disable this awesome feature (read: to fix this bug), just throw this code anywhere, like we did:
This fix works whenever you want to use Mootools' Drag class on an image. Sweet!