File tree Expand file tree Collapse file tree 1 file changed +15
-1
lines changed Expand file tree Collapse file tree 1 file changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -61,12 +61,26 @@ You can also simply use one of the built in methods of transforming DOM elements
61
61
// uses margin-left, margin-top, width and height
62
62
fit( bar, foo, fit.cssMargin );
63
63
64
- But fit.js was designed to be used with any kind of rectangular object, not just DOM elements.
64
+ But fit.js was designed to be used with any kind of rectangular object, not just DOM elements
65
65
66
66
var area = { x: 20, y: 20, width: 400, height: 300 };
67
67
var rect = { x: 0, y: 0, width: 100, height: 120 };
68
68
fit( rect, area );
69
69
70
+ If you are using the DOM, you can tell fit to run again whenever the window resizes. To do this, simply set the ` watch ` option to ` true `
71
+
72
+ // This will trigger a fit each time the window resizes
73
+ var watching = fit( bar, foo, { watch: true } );
74
+
75
+ // You can stop watching at any time
76
+ watching.off();
77
+
78
+ // And start watching again
79
+ watching.on();
80
+
81
+ // And trigger a fit manually too
82
+ watching.trigger();
83
+
70
84
For some visual examples, check out the [ demo page] ( http://soulwire.github.io/fit.js/ ) .
71
85
72
86
### Why?
You can’t perform that action at this time.
0 commit comments