Skip to content
This repository was archived by the owner on Feb 7, 2023. It is now read-only.

Commit 8342f39

Browse files
committed
Hide annotations/code containers when window is resized
1 parent ca4c0f1 commit 8342f39

File tree

5 files changed

+19
-718
lines changed

5 files changed

+19
-718
lines changed

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,8 @@ latest-change.txt
1515
/public/styleguide/css/styleguide.scss
1616

1717
/core/styleguide/css/.sass-cache/
18+
19+
/public/styleguide/js/styleguide.js
20+
21+
/public/styleguide/js/annotations-viewer.js
22+
/public/styleguide/js/code-viewer.js

core/styleguide/js/annotations-viewer.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,13 @@ var annotationsViewer = {
2121

2222
// not sure this is used anymore...
2323
$('body').addClass('comments-ready');
24+
25+
$(window).resize(function() {
26+
if(!commentsActive) {
27+
annotationsViewer.slideComment($('#sg-annotation-container').outerHeight());
28+
}
29+
});
30+
2431
$('#sg-t-annotations').click(function(e) {
2532

2633
e.preventDefault();
@@ -226,7 +233,7 @@ var annotationsViewer = {
226233
annotationsViewer.slideComment($('#sg-annotation-container').outerHeight());
227234
}
228235
} else if (data.annotationState !== undefined) {
229-
document.getElementById("annotation-state-"+data.displayNumber).innerHTML = (data.annotationState === true) ? "" : " hidden";
236+
document.getElementById("annotation-state-"+data.displayNumber).innerHTML = (data.annotationState == true) ? "" : " hidden";
230237
} else if (data.displaynumber !== undefined) {
231238
annotationsViewer.moveTo(data.displaynumber);
232239
} else if (data.keyPress !== undefined) {

core/styleguide/js/code-viewer.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,12 @@ var codeViewer = {
2525

2626
// not sure this is needed anymore...
2727
$('body').addClass('code-ready');
28+
29+
$(window).resize(function() {
30+
if(!codeActive) {
31+
codeViewer.slideCode($('#sg-code-container').outerHeight());
32+
}
33+
});
2834

2935
// add the onclick handler
3036
$('#sg-t-code').click(function(e) {

public/styleguide/js/annotations-viewer.js

Lines changed: 0 additions & 282 deletions
This file was deleted.

0 commit comments

Comments
 (0)