First of all, i was amazed when i got such a nice feedback from the jQuery community, telling me how they use my plug-in. Most of the people contacted me about it use the floating object for a floating menu in a web site – which i think adds a nice touch to it.
Some of the feedback i got referred me to a bug in the plug-in, This bug happens when the browser size is too small to fit the floating object, and when the user tries to scroll strange things happened.
After examining the code i found the problem and released a new version: 1.2 (yes there was a 1.1 in the middle, but it wasn’t stable enough).
You can download the latest version from jQuey web site: http://plugins.jquery.com/node/9699
Whats New
I’ve fixed the bugs and added a new parameter to the main function: alwaysVisible.
alwaysVisible - true or false (default). If this parameter is set to true, then the new version changes kicks in. If this parameter is not set, or set to false, then the plug-in works as it did in the first version – so there is backward compatibility.
Here is an example of how to use the new parameter:
$("#video").makeFloat({x:"current",y:"current", alwaysVisible:true});
What Was Changed
In the updateLocation method i’ve added the following code:
if( this.alwaysVisible )
{
if( this.origX + this.width > this.windowWidth() )
this.updatedX = this.windowWidth() - this.width + $(window).scrollLeft();
if( this.origY + this.height > this.windowHeight() )
this.updatedY = this.windowHeight() - this.height + $(window).scrollTop();
}
This code is only executed if the user has set the new parameter, otherwise its the same behavior as in the first version.
Basically what i’m checking here is to see if the floating object location and size fits the actual browser window size, and if it doesn’t i try squeeze it to the top/left as much as i can.
That’s it.
If you have any further questions or comments, don’t hesitate to reach me – either by a comment or via twitter: @amir_harel.








