You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+9-7Lines changed: 9 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,9 +2,11 @@
2
2
3
3
## Intelligent cropping for flexible image containers
4
4
5
+

6
+
5
7
Websites don't have a single layout any more. The space you have for an image may be portrait on a laptop, landscape on a tablet, and square on a mobile - particularly if you're using a full-screen image.
6
8
7
-

9
+
If you have to use the same image file in all these contexts, you might not be happy with the results you get when you 'fill' the allocated space with your image. Your subject might be clipped or completely missing, or just really awkward looking.
8
10
9
11
FocusPoint makes sure your image looks great in any container, by ensuring the 'spare' parts of your image (negative space) are cropped out before the important parts.
10
12
@@ -28,23 +30,23 @@ FocusPoint requires you to indicate where this focal point is located within you
28
30
29
31
## How to use
30
32
31
-
#### Calculate your image's focus point
33
+
#### 1. Calculate your image's focus point
32
34
33
-
An image's **focus point** is made up of x (horizontal) and y (vertical) coordinates. The value of a coordinate can be a number with decimal points anywhere between -1 and +1, where 0 is the centre. X:-1 indicates the left edge of the image, x:1 the right edge. For the y axis, y:1 is the top edge and y:-1 is the bottom.
35
+
An image's focus point is made up of x (horizontal) and y (vertical) coordinates. The value of a coordinate can be a number with decimal points anywhere between -1 and +1, where 0 is the centre. X:-1 indicates the left edge of the image, x:1 the right edge. For the y axis, y:1 is the top edge and y:-1 is the bottom.
34
36
35
37

36
38
37
-
**Pretty confusing eh?** Don't worry, I've included a handy script to help you find the focus coordinates of an image with a single click. [See an example here](http://jonom.github.io/jquery-focuspoint/demos/helper/index.html).
39
+
**Confused?** Don't worry, I've included a handy script to help you find the focus coordinates of an image with a single click. [See an example here](http://jonom.github.io/jquery-focuspoint/demos/helper/index.html).
38
40
39
-
#### Include javascript and CSS
41
+
#### 2. Include javascript and CSS
40
42
41
43
You'll need to include jQuery, the FocusPoint script, and FocusPoint css file. Example:
42
44
43
45
<link rel="stylesheet" href="focuspoint.css">
44
46
<script src="jquery.js"></script>
45
47
<script src="focuspoint.js"></script>
46
48
47
-
#### Mark up image container
49
+
#### 3. Mark up image container
48
50
49
51
Specify the image dimensions and focus point coordinates on the image container. Note: I know it shouldn't really be necessary to specify image dimensions but I've found this to be more reliable than reading the dimensions from the image. Example:
50
52
@@ -56,7 +58,7 @@ Specify the image dimensions and focus point coordinates on the image container.
56
58
<img src="image.jpg" alt="" />
57
59
</div>
58
60
59
-
#### Fire FocusPoint plugin
61
+
#### 4. Fire FocusPoint plugin
60
62
61
63
Usually the best place for this will be inside your `$(document).ready()` function.
0 commit comments