Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
…esizer

Conflicts:
	bower.json
  • Loading branch information
davidjbradshaw committed Jun 11, 2015
2 parents cb4cb04 + 4471381 commit 7294f01
Show file tree
Hide file tree
Showing 8 changed files with 29 additions and 10 deletions.
8 changes: 6 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
# Image Map Resize
[![Bower version](https://badge.fury.io/bo/image-map-resizer.svg)](http://badge.fury.io/bo/image-map-resizer)
[![npm version](https://badge.fury.io/js/image-map-resizer.svg)](http://badge.fury.io/js/image-map-resizer)
![license](http://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat)

[![NPM](https://nodei.co/npm/image-map-resizer.png)](https://nodei.co/npm/image-map-resizer/)

*This is a simple library that makes HTML Image Maps responsive, so that they automagically stay scaled to the size of the image they are attached to. It detects the window being resized and updates the co-ordinates of the image map accordingly.*

*This library can be used with or without jQuery.*

### Native JS Usage

Inclue the [imageMapResizer.min.js](https://raw.github.com/davidjbradshaw/imagemap-resizer/master/js/imageMapResizer.min.js) srcipt then add the following call to the bottom of your page:
Inclued the [imageMapResizer.min.js](https://raw.github.com/davidjbradshaw/imagemap-resizer/master/js/imageMapResizer.min.js) script then add the following call to the bottom of your page:

```js
imageMapResize([selector || map object]);
Expand Down Expand Up @@ -50,3 +52,5 @@ To use this library with old IE you will need to also load the included polyfil
### License
Copyright © 2014 [David J. Bradshaw](https://github.com/davidjbradshaw).
Licensed under the [MIT license](http://opensource.org/licenses/MIT).

[![NPM](https://nodei.co/npm/image-map-resizer.png)](https://nodei.co/npm/image-map-resizer/)
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "image-map-resizer",
"version": "0.5.3",
"version": "0.5.4",
"homepage": "https://github.com/davidjbradshaw/image-map-resizer",
"authors": [
"David J. Bradshaw <[email protected]>"
Expand Down
2 changes: 1 addition & 1 deletion gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ module.exports = function(grunt) {
grunt.registerTask('notest', ['jshint','uglify']);
grunt.registerTask('test', ['jshint','qunit']);

grunt.registerTask('postBump',['git bump-commit','shell']);
grunt.registerTask('postBump',['bump-commit','shell']);
grunt.registerTask('patch', ['default','bump-only:patch','postBump']);
grunt.registerTask('minor', ['default','bump-only:minor','postBump']);
grunt.registerTask('major', ['default','bump-only:major','postBump']);
Expand Down
2 changes: 1 addition & 1 deletion imageMapResizer.jquery.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"resize",
"design"
],
"version": "0.5.3",
"version": "0.5.4",
"author": {
"name": "David J. Bradshaw",
"email": "[email protected]"
Expand Down
17 changes: 16 additions & 1 deletion js/imageMapResizer.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,27 @@
}

function start(){
var
displayedWidth = null,
displayedHeight = null;

//WebKit asyncs image loading, so we have to catch the load event.
sourceImage.onload = function sourceImageOnLoadF(){
if ((displayedImage.width !== sourceImage.width) || (displayedImage.height !== sourceImage.height)) {
displayedWidth = displayedImage.width;
displayedHeight = displayedImage.height;

if ((displayedWidth !== sourceImage.width) || (displayedHeight !== sourceImage.height)) {
resizeMap();
}
};

//IE11 can late load this image, so make sure we have the correct sizes (#10)
displayedImage.onload = function() {
if (null !== displayedWidth && displayedImage.width !== displayedWidth) {
resizeMap();
}
};

//Make copy of image, so we can get the actual size measurements
sourceImage.src = displayedImage.src;
}
Expand Down
2 changes: 1 addition & 1 deletion js/imageMapResizer.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions js/imageMapResizer.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "image-map-resizer",
"version": "0.5.3",
"version": "0.5.4",
"repository": {
"type": "git",
"url": "https://github.com/davidjbradshaw/image-map-resizer.git"
Expand Down

0 comments on commit 7294f01

Please sign in to comment.