Skip to Content

The jQuery Magnifier

Tags:

UPDATE: It looks like the old Magnifier is no longer part of the jQuery UI library.  I'm looking into possible replacements, but most that I've found degrade horribly if you don't have JavaScript enabled.  If you know of a good Magnifier/Dock, please leave me a note in the comments section of this page or drop me a line.  Thanks.

The more I use jQuery, the more I like it! Until now, I'd limited my use of effects (eye candy) to some basic fades. On a new website I'm working on, the designer wants more pizazz so I've been playing with some of the jQuery UI tools, namely the Magnifier which produces a fisheye lens effect similar to Apple's Dock (OS X or later). In short, a line of icons is magnified, as if a fisheye lens were passing over it, as the user moves their mouse near the icons. Beyond looking cool, the effect is a bonus for usability -- at least for the average user.

Designers can now put more icons into the same space without worrying about icons being too small and users not understanding them. As users hover over the toolbar, the images grow making them easier to see and creating a larger click zone. Granted, this requires using a mouse. In fact, you can only use the Magnifier on images, not links, making your page even harder to deal with for some folks not to mention search engine spiders. However, for a photographer's portfolio website, we were willing to assume most users would be mousing and not keyboarding or screen-reading the page. And submitting a sitemap to the major search engines can be additional work, but it can get past the no-link limitation. I'll update this page as things move along...

Update 1:

Make sure you start the Magnifier after the images are in the final location. For example, if you had HTML like this:

<div id="wrapper">
  <div id="content">
    <p>This is content</p>
  </div>
  <div id="menu">
    <img width="48" align="left" alt="" src="http://dev.jquery.com/view/tags/ui/1.0.1a/demos/images/clock.png" />
    <img width="48" align="left" alt="" src="http://dev.jquery.com/view/tags/ui/1.0.1a/demos/images/clock.png" />
    <img width="48" align="left" alt="" src="http://dev.jquery.com/view/tags/ui/1.0.1a/demos/images/clock.png" />
  </div>
</div>

CSS like this:

#everything {
  width: 850px; 
  margin: 0 auto; 
  position: relative; 
  display: none; 
} 
#menu {
  position: absolute; 
  top: 10px; left: 0;
  width: 50px; 
}
#content {
  margin-left: 50px;
  width: 800px;
}

And JavaScript like this:

$( document ).ready( function(){
  $( "#everything" ).show( 500 );
  $( "#menu" ).magnifier();
});

The result would be this. Hovering in the middle of the screen gives you the Magnifier effect. Why? Because that's where the images were when magnifier() was called. Calling show( 500 ) causes <div id="wrapper"></div> to slide into place over half a second (500 milliseconds). To fix this, you need to wait until the slide effect has finished before calling magnifier():

$( document ).ready( function() {
  $( "#everything" ).show( 500, function() {
$( "#menu" ).magnifier();
}
); });

Which gives you what you'd expect.

 

 

same question: what to use now?

hi, i'm looking for a very simple text magnifier/dock jquery plugin. why was magnifier removed from jquery ui? unstable? i'll check back here in a few days to see if there are good leads. thx!

Good question, no good answers...

After poking around for a while, I haven't been able to find any good replacements for the jQuery Magnifier.  I've started writing my own plugin, but paying work got in the way and I haven't had a chance to finalize it yet.  I suppose I could post what I have (currently just works for images, not text) if I get a chance to clean up the code a bit.

If you find anything that works, let me know!

Thanks.

Hover Pulse is a suitable replacement

This one does more than an adequate job of the task. http://jquery.malsup.com/hoverpulse/

thanks

thanks

Hoverpulse does not to the

Hoverpulse does not to the slightest do the same as the old magnifier plugin did. This plugin released not long ago seems to do the job. http://plugins.jquery.com/project/MagnifyEffect

Who are the best VPS hosting providers?

Hi, I am looking for a VPS solutions. Who is the best provider in your eyes of VPS hosting? -Rick

+1

+1

bkw qewp

dtukua bkw qewp tdXsodk

Post new comment

The content of this field is kept private and will not be shown publicly.