odyniec.net

Archive for the ‘Projects’ Category

New Version of ImgZoom in Development

Tuesday, March 9th, 2010

Last weekend I started working on the next version of imgZoom, the jQuery plugin that uses vector graphics to implement a smooth zoom effect on thumbnailed images. With the initial release (a couple months back), I boldly announced that I intend to one day turn it into a decent substitution for Lightbox, and I think I’m actually getting closer to that. The current version has the lightbox-esque features of displaying images in a window, and allowing to navigate between previous and next images.

I transformed one of my testing pages into a nicely-looking gallery, so if you want to take a look at the development version in action, be my guest. The gallery should work correctly in most browsers, only Internet Explorer might still have some issues — I’m working on that. As always, I’m open to feedback.

ImgAreaSelect 0.9.2

Saturday, February 20th, 2010

ImgAreaSelect version 0.9.2 is out. This version fixes a few minor bugs, and introduces a new option that allows you to completely remove the plugin from the image that it was attached to. Thanks to all the people who helped me by reporting bugs and sending feedback.

I have also added a new example to the Advanced Usage page — it demonstrates an extension of the plugin API that allows you to animate the selection area.

SelectList 0.1.2

Sunday, January 31st, 2010

I’ve just released a new version of the selectList jQuery plugin — no exciting new features, though, this release only fixes a bug that generated a JavaScript error in IE6 when there were no options in the original select field (thanks to CJ for reporting this).

SelectList 0.1.1

Saturday, October 31st, 2009

Here’s another minor update to one of my jQuery plugins — this time it’s selectList, version 0.1.1. The update is mostly a code cleanup, with one functional change — if a hint has been provided with the title attribute, it is always shown as the currently selected option in the dropdown list after each selection takes place (as requested by some).

ImgZoom 0.1.1

Friday, October 2nd, 2009

Today I released a new version of imgZoom. It’s just a minor update that fixes one bug and introduces the getOptions() API method.

I have also updated the documentation — it now includes a reference of the available API methods.

ImgAreaSelect 0.9.1

Friday, August 7th, 2009

I have just released an update to imgAreaSelect with a version number of 0.9.1. It fixes a nasty bug found in version 0.9 that affected the initialization stage, causing some unexpected behavior (like not being able to set the initial selection) and JavaScript errors.

Thanks to all the people who noticed the bug and reported it to me.

ImgZoom 0.1

Monday, August 3rd, 2009

Here’s yet another jQuery plugin made by yours truly. ImgZoom creates a smooth zoom effect for thumbnailed images by doing a graceful transition from the thumbnail to the full-size image. Feel welcome to take a look at the live demo.

There are already a few jQuery plugins that do this, but as far as I know they all achieve the zoom effect by gradually changing the dimensions of HTML image elements. ImgZoom, on the other hand, utilizes the vector graphics capabilities found in browsers (including Internet Explorer), which results in really smooth animation and allows for additional effects to be incorporated into the process.

I’m releasing the plugin a bit early, as it only has about half of the functionality that I intend to implement. My long-term evil plan is to make the plugin a viable alternative to Lightbox et al, with prev/next links, keyboard support and such. Anyway, I’ll be happy to get some feedback on this premature 0.1 release — let me know if you like the plugin, whether you think it would be useful, and what features you would like to see in future versions.

ImgAreaSelect 0.9

Monday, July 20th, 2009

I finally found enough time to finish developing the new version of imgAreaSelect, and I’m happy to announce it’s available for download.

This release brings a few major changes and new features — here’s a summary:

  • Styling the plugin is now done with CSS (the old styling options are still supported)
  • A new option has been added to show/hide the plugin with a fade effect
  • A new option has been added to get an instance of the plugin’s object
  • Some of the plugin’s methods have been made public and can be called through the instance
  • A new callback function has been introduced (onInit)

Implementing and testing the new features took me about one third of the total time I worked on this version, I spent the rest cleaning up and refactoring the code. As a result, although the new version has many new features, it’s actually a bit smaller that the previous release (0.8). The packed JavaScript file (included in the distribution package) is less than 8KB in size.

The plugin’s project page has also undergone some face lift and reorganization. The documentation is now on a separate page, and there’s a new examples page (at this moment, only three examples are included, but I will be adding more soon, I promise).

There is also a special bonus for all the people who want to modify the plugin’s source code and implement their own solutions based on it — I have made available an extensively commented version of the source code.

SelectList 0.1

Friday, June 5th, 2009

I have developed a new jQuery plugin, called selectList. It’s purpose is to transform the standard multiple selection box used in web forms into a nicely looking list that you can add items to and remove items from. So, it turns this:

Traditional selection box

Into this:

selectList

Apart from the more attractive appearance, the list approach is also better in terms of user friendliness, as all the selected items are shown to the user all the time. With the traditional solution, the user often has to scroll the box to check if all the desired options have been highlighted.

The plugin is actually an extension of the idea that I demonstrated in an article on multiple select fields that I wrote some time ago. Back when I wrote it, I thought of developing this plugin, and, well, I finally had a spare afternoon to write it (and half of night to deal with browser incompatibilities). Be my guest and take a look at the project page and some examples — as usual, your feedback is more than welcome.

ImgAreaSelect vs. Dashed Borders in IE

Friday, April 24th, 2009

In the recently released version 0.8 of imgAreaSelect, I introduced the borderOpacity option, which (as the name implies) allows you to set the opacity of the selection area border. It’s set to 0.5 by default, making the border semi-transparent, and giving the plugin a slightly more attractive look (at least in my opinion).

I didn’t expect that such a simple change might lead to any kind of a problem, but, well, having been dealing with browser bugs for the past few years I should have known better. The semi-transparent border looks and behaves fine in all browsers except one. Can you guess which one? Yeah, that was too easy — of course it’s Internet Explorer.

IE6 and IE7 display the border incorrectly when the selection area is being resized. The dashed border suddenly appears as if it was a solid line. Here’s the correct rendering in Firefox:

Selection area border in Firefox

And this is how IE6 and IE7 render it while resizing:

Selection area border in IE

It gets back to normal when the mouse cursor moves over the selection area. OK, so this is what happens in IE6 and IE7 — I thought that the super-standards-compliant IE8 would get this right, but I was waaay wrong. In fact, it seems IE8 takes this bug to the next level, as it displays the border incorrectly all the time, even if no resizing is taking place.

I’ve investigated this issue a bit and discovered that the border is not really turning into a solid line, it’s just that the empty space between dashes gets filled with white. And since the top-level dashes are also white (that’s the default value of borderColor2), it looks like a solid line. Interestingly, this only happens if the border is exactly one pixel wide.

I found out that the bug has already been reported to the IE8 team at Microsoft, so there’s a slight chance that it will be fixed in the final version that’s supposed to come out in the next few months. Nevertheless, I still had to find a workaround to at least make it work correctly in IE6 and IE7.

The fact that moving the mouse pointer over the bordered div seemed to fix the problem gave me hope that I might be able to force the div to be repainted, for example by playing with its margin/padding properties. And it turned out to be partially true — toggling the margin property between "0" and "auto" (which is visually the same) makes the border fine again. So basically, every time the selection area was being updated, I had to do this:

$border1.add($border2).css('margin', '0'); $border1.add($border2).css('margin', 'auto');

Or, not exactly this. Unfortunately, it only works if the incorrect “solid” border is actually rendered first. There must be some delay after the first .css() call to let IE draw it incorrectly, then the second call fixes it. Putting the second call in setTimeout() does the trick:

$border1.add($border2).css('margin', '0'); setTimeout(function () { $border1.add($border2).css('margin', 'auto'); }, 0);

This method has a side effect of causing the border to flicker a bit — it’s barely noticeable, but still. Additionally, it doesn’t do any good in IE8, as that bastard just fills the empty spaces with white no matter what. All in all, it’s an ugly and insufficient workaround, but it’s the best I’ve come up with so far. If anyone knows of or has an idea for a better solution, please let me know.

Regardless of whether I find a better workaround or not, imgAreaSelect 0.9 is going to support image-based borders, allowing you to effectively circumvent all this border-related stupidity of Internet Explorer.