Permalink
Browse files

Show the size of the output window for you repsonsive lovers. Fixes #530

  • Loading branch information...
1 parent efd8104 commit 41ef614f1fcb201c4f7dcaca6af40ed383ff554a @remy remy committed Mar 28, 2013
Showing with 13 additions and 0 deletions.
  1. +12 −0 public/js/render/live.js
  2. +1 −0 views/index.html
View
@@ -167,6 +167,18 @@ function renderLivePreview(withalerts) {
liveScrollTop = this.scrollY;
};
+ var size = $live.find('.size'),
+ timer = null;
+
+ var hide = throttle(function () {
+ size.fadeOut(200);
+ }, 2000);
+ $(win).on('resize', function () {
+ // clearTimeout(timer);
+ size.show().html(this.innerWidth + 'px');
+ hide();
+ });
+
win.resizeJSBin = throttle(function () {
var height = ($body.outerHeight(true) - $frame.height()) + doc.documentElement.offsetHeight;
window.parent.postMessage({ height: height }, '*');
View
@@ -263,6 +263,7 @@
<label>Auto-run JS<input type="checkbox" id="enablejs"></label>
<a target="_blank" title="Live preview" id="jsbinurl" class="{{^code_id}}hidden{{/code_id}}" href="{{code_id_path}}"><img src="{{static}}/images/popout.png"></a>
</span>
+ <span class="size"></span>
</div>
</div>
</div>

0 comments on commit 41ef614

Please sign in to comment.