FixedPosition > a jQuery Plugin
What is Position: Fixed
?
It’s a powerful CSS attribute, that allows you to fix a HTML element to a position on the page, irrespective of user interaction. Put simply, if the user scrolls, it stays put.
FixedPosition doesn’t jitter on scroll, it looks at capability (not user-agent), works in Internet Explorer 6, 7, 8 … about time huh.
What’s the Problem
As web developers (now let’s be honest), we face an interesting challenge when it comes to CSS and Internet Explorer. Did you know that IE7 & 8 only support fixed positioning when using a strict doctype? Quirks Mode still remains IE8’s default, meaning that we still need a graceful way of using this CSS gem.
Am I picking on IE?
Nah. I’m a big advocate for your right to choose a platform, device and browser. Heck, just read my article on Progressive Enhancement. This plug-in is all about delivering a consistent user experience (no matter the browser). It’s also about providing another tool to the cohort of web developers ( hi there ) to help make our career easier. Don’t forget, web development is considered the most hostile environment to develop software for..
How can we solve it?
Through a blend of CSS and JavaScript, we can gracefully achieve this functionality. That’s what this plug-in is all about.
Plug-in Features
- Uses jQuery, a framework you already know
- Support for IE6, 7 & 8
- Integrates the IE
Speed Fix
to ensure a fluent user experience - It check for capability, not user-agent
- Supports Standard and Quirks mode
- Progressively Enhances your webpage
How to use it
- Download the jQuery framework
- Download the FixedPosition plug-in
- Observe the below example code
Example Code
<!--[if GTE IE 6]><!-->
<!-- The jQuery Framework -->
<script src="http://jqueryjs.googlecode.com/files/jquery-1.3.2.min.js"></script>
<!-- The FixedPosition plugin -->
<script src="jquery.fixedposition.1.0.0-min.js"></script>
<!-- Call the plugin on your jQuery object when the DOM is ready -->
<script>
$(document).ready(function(){
$(".fixedbar").fixedPosition({
debug: true,
fixedTo: "bottom",
effect: "slideDown",
effectSpeed: 200
});
});
</script>
<!--<![endif]-->;
Plugin Options:
- fixedTo: “top”, “bottom”
- debug: true, false
- effect: false, “fadeIn”, “slideDown”
- effectSpeed: Number
Tested On:
- Internet Explorer 6.0.29 / WinXP
- Internet Explorer 7.0.57 / WinXP
- Internet Explorer 8.0.71 / Win7
- Firefox 2.0.0.20 / WinXP
- Google Chrome 3.0.195.38 / WinXP
- Firefox 3.5.6 / OSX 10.5.8
- Safari 4.0.4 / OSX 10.5.8






Can it be used to fix divs to the corners? E.g., top left, top right, bottom left, bottom right?
Thanks
Didn’t work for me.
we have
…some inner content
we currently have:
.SocialLearnToolbarToolbar {white-space:nowrap;margin:0 auto;width:960px;position:fixed;bottom:0px;left:50%;margin-left:-480px;z-index:1000}
and I tried:
$(“.SocialLearnToolbarToolbar”).fixedPosition({
debug: false,
fixedTo: “bottom”,
effect: “false”
});
- I get the correct debug info with debug set to true so the plugin is loaded.
In IE8 and IE7 quirks mode before our bar was mostly off the page at the left and scrolling, not fixed. After applying the plugin it is now more on-screen and close to the bottom of the view-port when we load it – but still scrolls as soon as you use the scroll-bars.
We are loading a ‘toolbar’ using a JS bookmarklet and the root element which we want fixed is added to the DOM dynamically. – after the plugin is added to jQuery but we don’t call the plugin method until a ready function indicates that the root element has been created.
Any ideas?
Thanks
Justin Wyllie
e. justinwyllie@hotmail.co.uk
The above problem was resolved.
I have posted another problem on your Google code page http://code.google.com/p/fixedposition/issues/list