Skip to content

Commit

Permalink
Eliminate the big gap from #527 with jQuery and CSS3
Browse files Browse the repository at this point in the history
* Remove static CSS for sizing and control this all via jQuery with a little inline CSS. Dynamic style sheets could be used but that is probably overkill.
* JavaScript is required to comment so using jQuery here
* *bootstrap* has events... using them
* Ease the transitions with CSS3. Even Opera Presto 12.16 has support here.

Applies to #520
  • Loading branch information
Martii committed Jan 13, 2015
1 parent f5565e6 commit ddbd0e2
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 4 deletions.
17 changes: 15 additions & 2 deletions views/includes/scripts/commentReplyScript.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,17 @@
<script type="text/javascript">
// Show spacer div
$('#reply-control').on('shown.bs.collapse', function () {
$('#show-reply-form-when-visible').css({
height: '200px'
});
});

// Hide spacer div
$('#reply-control').on('hidden.bs.collapse', function () {
$('#show-reply-form-when-visible').css({
height: '0'
});
});

$('.btn-comment-reply').click(function (aE) {
$('#reply-control').collapse('show');
Expand All @@ -20,7 +33,7 @@
});

function isElementInViewport(aEl) {
//special bonus for those using jQuery
// special bonus for those using jQuery
if (aEl instanceof jQuery) {
aEl = aEl[0];
}
Expand Down Expand Up @@ -53,7 +66,7 @@

var handler = fireIfElementVisible ($('#show-reply-form-when-visible'), callback);

//jQuery
// jQuery
$(window).on('DOMContentLoaded load resize scroll', handler);

</script>
8 changes: 7 additions & 1 deletion views/pages/discussionPage.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,13 @@
{{> includes/head.html }}
<link rel="stylesheet" type="text/css" media="all" href="/redist/npm/bootstrap-markdown/css/bootstrap-markdown.min.css">
<style>
#show-reply-form-when-visible { height: 200px; }
#show-reply-form-when-visible {
-moz-transition: height 1s ease;
-ms-transition: height 1s ease;
-o-transition: height 1s ease;
-webkit-transition: height 1s ease;
transition: height 1s ease;
}
</style>
</head>
<body>
Expand Down
8 changes: 7 additions & 1 deletion views/pages/scriptIssuePage.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,13 @@
<link rel="stylesheet" type="text/css" media="all" href="/redist/npm/bootstrap-markdown/css/bootstrap-markdown.min.css">
<link rel="stylesheet" type="text/css" media="all" href="/css/scriptPage.css">
<style>
#show-reply-form-when-visible { height: 200px; }
#show-reply-form-when-visible {
-moz-transition: height 1s ease;
-ms-transition: height 1s ease;
-o-transition: height 1s ease;
-webkit-transition: height 1s ease;
transition: height 1s ease;
}
</style>
</head>
<body>
Expand Down

0 comments on commit ddbd0e2

Please sign in to comment.