Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-platform
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
edx-platform
Commits
890c5e50
Commit
890c5e50
authored
Sep 04, 2012
by
Arjun Singh
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix up sidebar jitter
parent
dbfe3b35
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
91 additions
and
22 deletions
+91
-22
lms/static/js/discussions-temp.js
+78
-21
lms/static/sass/_discussion.scss
+13
-1
No files found.
lms/static/js/discussions-temp.js
View file @
890c5e50
...
...
@@ -272,34 +272,91 @@ function setFormTopic(e) {
$formTopicDropBtn
.
html
(
boardName
+
' <span class="drop-arrow">▾</span>'
);
}
function
updateSidebarCoordinates
(
e
)
{
scrollTop
=
$
(
window
).
scrollTop
();
sidebarXOffset
=
$
(
'.discussion-column'
).
offset
().
top
;
var
marginTop
=
scrollTop
+
SIDEBAR_PADDING
>
sidebarXOffset
?
scrollTop
+
SIDEBAR_PADDING
-
sidebarXOffset
:
0
;
//function updateSidebarCoordinates(e) {
// scrollTop = $(window).scrollTop();
// sidebarXOffset = $('.discussion-column').offset().top;
//
// var marginTop = scrollTop + SIDEBAR_PADDING > sidebarXOffset ? scrollTop + SIDEBAR_PADDING - sidebarXOffset : 0;
//
// var discussionColumnHeight = $('.discussion-column').height();
// marginTop = marginTop + sidebarHeight > discussionColumnHeight ? discussionColumnHeight - sidebarHeight + 2 : marginTop;
//
// $sidebar.css('margin-top', marginTop);
// updateSidebarDimensions();
//}
//
//function updateSidebarDimensions(e) {
// sidebarWidth = $sidebar.width();
//
// var visibleHeader = sidebarXOffset - scrollTop > 0 ? sidebarXOffset - scrollTop : 0;
// sidebarHeight = $(window).height() - (visibleHeader + SIDEBAR_PADDING * 2);
// sidebarHeight = sidebarHeight > 500 ? sidebarHeight : 500;
//
// var titleWidth = sidebarWidth - 115;
//
// $sidebar.css('height', sidebarHeight + 'px');
//
// if(!$postListWrapper[0]) {
// $postListWrapper = $('.post-list-wrapper');
// }
//
// $postListWrapper.css('height', (sidebarHeight - SIDEBAR_HEADER_HEIGHT - 4) + 'px');
// $sidebarWidthStyles.html('.discussion-body .post-list a .title { width: ' + titleWidth + 'px !important; }');
//}
var
discussionColumnHeight
=
$
(
'.discussion-column'
).
height
();
marginTop
=
marginTop
+
sidebarHeight
>
discussionColumnHeight
?
discussionColumnHeight
-
sidebarHeight
+
2
:
marginTop
;
function
updateSidebarCoordinates
(
e
)
{
if
(
!
$
(
'.sidebar'
).
attr
(
'data-top'
)){
if
(
$
(
'.sidebar'
).
hasClass
(
'fixed'
)){
return
;
}
var
offset
=
$
(
'.sidebar'
).
offset
();
$
(
'.sidebar'
).
attr
(
'data-top'
,
offset
.
top
);
}
$
(
'.sidebar'
).
css
(
'width'
,
.
32
*
$
(
'.discussion-body'
).
width
()
+
'px'
);
scrollTop
=
$
(
window
).
scrollTop
();
offset
=
$
(
'.sidebar'
).
attr
(
'data-top'
);
if
((
offset
<=
scrollTop
)){
$
(
'.sidebar'
).
addClass
(
'fixed'
);
$
(
'.discussion-column'
).
addClass
(
'sidebar-fixed'
);
}
else
{
$
(
'.sidebar'
).
removeClass
(
'fixed'
);
$
(
'.discussion-column'
).
removeClass
(
'sidebar-fixed'
);
}
discussionColumnHeight
=
$
(
'.discussion-column'
).
outerHeight
();
discussionColumnBottom
=
$
(
'.discussion-column'
).
offset
().
top
+
discussionColumnHeight
;
windowHeight
=
$
(
window
).
height
();
if
((
discussionColumnBottom
-
scrollTop
)
<
windowHeight
){
//difference = minHeight - (discussionColumnBottom - scrollTop);
//$('.sidebar').height(minHeight);
//console.log(minHeight);
//$('.sidebar').css('top', -difference);
//$('.post-list-wrapper').height(minHeight - SIDEBAR_HEADER_HEIGHT - 4);
$
(
'.sidebar'
).
removeClass
(
'fixed'
);
$
(
'.discussion-column'
).
removeClass
(
'sidebar-fixed'
);
}
$sidebar
.
css
(
'margin-top'
,
marginTop
);
updateSidebarDimensions
();
}
function
updateSidebarDimensions
(
e
)
{
sidebarWidth
=
$sidebar
.
width
();
var
visibleHeader
=
sidebarXOffset
-
scrollTop
>
0
?
sidebarXOffset
-
scrollTop
:
0
;
sidebarHeight
=
$
(
window
).
height
()
-
(
visibleHeader
+
SIDEBAR_PADDING
*
2
);
sidebarHeight
=
sidebarHeight
>
500
?
sidebarHeight
:
500
;
discussionColumnHeight
=
$
(
'.discussion-column'
).
outerHeight
();
discussionColumnBottom
=
$
(
'.discussion-column'
).
offset
().
top
+
discussionColumnHeight
;
windowHeight
=
$
(
window
).
height
();
$
(
'.sidebar'
).
height
(
discussionColumnHeight
);
$
(
'.post-list-wrapper'
).
height
(
discussionColumnHeight
-
SIDEBAR_HEADER_HEIGHT
-
4
);
$
(
'.sidebar'
).
css
(
'width'
,
.
32
*
$
(
'.discussion-body'
).
width
()
+
'px'
);
var
titleWidth
=
sidebarWidth
-
115
;
$sidebar
.
css
(
'height'
,
sidebarHeight
+
'px'
);
if
(
!
$postListWrapper
[
0
])
{
$postListWrapper
=
$
(
'.post-list-wrapper'
);
}
//$('.sidebar').height(discussionColumnBottom - scrollTop);
//$('.post-list-wrapper').height(discussionColumnBottom - scrollTop - SIDEBAR_HEADER_HEIGHT - 4);
$postListWrapper
.
css
(
'height'
,
(
sidebarHeight
-
SIDEBAR_HEADER_HEIGHT
-
4
)
+
'px'
);
$sidebarWidthStyles
.
html
(
'.discussion-body .post-list a .title { width: '
+
titleWidth
+
'px !important; }'
);
//if((discussionColumnBottom - scrollTop) < windowHeight){
// $('.sidebar').height(discussionColumnHeight);
// $('.post-list-wrapper').height(discussionColumnHeight - SIDEBAR_HEADER_HEIGHT - 4);
//}
}
lms/static/sass/_discussion.scss
View file @
890c5e50
...
...
@@ -551,6 +551,14 @@ body.discussion {
background
:
#f6f6f6
;
border-radius
:
3px
0
0
3px
;
border-right
:
1px
solid
#bcbcbc
;
&
.fixed
{
@include
box-sizing
(
border-box
);
position
:
fixed
;
top
:
0px
;
width
:
32%
;
}
}
.browse-search
{
...
...
@@ -1008,7 +1016,11 @@ body.discussion {
background
:
#fff
;
box-shadow
:
0
1px
2px
rgba
(
0
,
0
,
0
,
.05
);
width
:
68%
;
min-height
:
500px
min-height
:
500px
;
&
.sidebar-fixed
{
margin-left
:
32%
;
}
}
.discussion-article
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment