Home > front end >  For help, not at the bottom of the vertical alignment of "directory navigation" JS, CSS
For help, not at the bottom of the vertical alignment of "directory navigation" JS, CSS

Time:09-26

I learn some fur is a small white, want to decorate next blog, a large number of code after the copy problem:

Try # uprightsideBar {vertical - align: bottom; },
Then try # manually uprightsideBar {114% margin: 0 px 0 px; }, although displays all right on this page, but in a piece of it and went to the above,,,



Assume that PM don't let you use margin, if there is a more fundamental way?

Blog question repetition: blog
Really don't want to, up request to help you pass by master!

The CSS part:
 
/* generate */
# uprightsideBar {
font-size:14px;
The text - align: left;
Position: fixed;
Bottom: 13%;
Right: 0 px;
Width: auto;
height: auto;
}
# sideBarTab {
Float: right;
width:30px;
Border - right: 3 px solid RGB (255204 ploidy);
text-align:center;
Background: # FFFFFF;
Color: # 777;
Padding: 8 px;
Box - shadow: 0 0 7 px rgba (100, 100, 100, 0.5);
}

# sideBarContents {
Float: right;
Overflow: auto;
Overflow - x: hidden; ! important;
Width: auto;
Min - height: 108 px;
Max - height: 460 px;
Border - left: 3 px solid RGB (255204 ploidy);
Background: # FFFFFF;
Box - shadow: - 1 px 0 8 px rgba (100, 100, 100, 0.5);
}
# sideBarContents dl {
margin:0;
padding:0;
}

# sideBarContents dt {
Margin: 12 px 10 px;
font-size: 16px;
}
# sideBarContents dd {
Margin: 8 px 20 px;
}

# sideBarContents dd and dt {
cursor: pointer;
}
# sideBarContents dd: hover, dt: hover {
Color: RGB (255204 ploidy);
}


JS:
 
/*
Function: to generate blog directory JS tool
Test: Internet explorer, firefox, Google test by
Aloof grey Wolf
The 2014-5-11
*/
Var BlogDirectory={
/*
To obtain element position, the distance from the browser left border (left) and the distance from the browser on boundary (top)
*/
GetElementPosition: function (ele) {
var topPosition=0;
var leftPosition=0;
While (ele) {
topPosition +=ele.offsetTop;
leftPosition +=ele.offsetLeft;
ele=ele.offsetParent;
}
Return {top: topPosition, left: leftPosition};
},

/*
Get the scroll bar
the current position*/
GetScrollBarPosition: function () {
Var scrollBarPosition=document. The body. The scrollTop | | document. The documentElement. ScrollTop;
Return scrollBarPosition;
},

/*
For the purpose of moving the scroll bar, finalPos position, internal for the mobile speed
*/
MoveScrollBar: function (finalpos, interval) {

//if they do not support this approach, the exit
if(! Window. ScrollTo) {
return false;
}

//form when rolling, disable mouse wheel
Window. onm ousewheel=function () {
return false;
};

//remove timing
If (document. The body. The movement) {
ClearTimeout (the document body. The movement);
}

Var currentpos=BlogDirectory. GetScrollBarPosition ();//get the scrollbar
the current position
Var dist=0;
If (currentpos==finalpos) {//reach desired location, then release the mouse scroll wheel, and exit the
Window. onm ousewheel=function () {
return true;
}
return true;
}
If (currentpos & lt; Finalpos) {//not to arrive, then to calculate the distance to move by
Dist=math.h ceil ((finalpos - currentpos)/10);
Currentpos +=dist.
}
If (currentpos & gt; Finalpos) {
Dist=math.h ceil ((currentpos - finalpos)/10);
Currentpos -=dist.
}

Var scrTop=BlogDirectory. GetScrollBarPosition ();//get the scrollbar
the current positionWindow. ScrollTo (0, currentpos);//move window
If (BlogDirectory getScrollBarPosition ()==scrTop)//if already to the bottom, then release the mouse scroll wheel, and exit the
{
Window. onm ousewheel=function () {
return true;
}
return true;
}

//move on to the next step
Var repeat="BlogDirectory. MoveScrollBar (" + finalpos +", "+ interval +") ";
Document. The body. The movement=setTimeout (repeat, the interval);
},

HtmlDecode: function (text) {
Var temp=document. The createElement method (" div ");
Temp. InnerHTML=text;
Var output=temp. The innerText | | temp. TextContent;
Temp=null;
Return the output;
},

/*
Create a blog directory,
Div id that contains the post text container id,
Mt and st respectively the main headings and sub headings of the tag name (such as H2, H3, uppercase or lowercase can!) ,
Interval according to the speed of moving
*/
CreateBlogDirectory: function (id, mt, st, interval) {
//access to post text div container
Var elem=document. GetElementById (id);
if(! Elem) return false.
//for all elements in the div node
Var nodes=elem. GetElementsByTagName (" * ");
//create blog directory div container
Var divSideBar=document. The createElement method (' DIV ');
DivSideBar. ClassName='uprightsideBar';
DivSideBar. SetAttribute (' id ', 'uprightsideBar');
Var divSideBarTab=document. The createElement method (' DIV ');
DivSideBarTab. SetAttribute (' id ', 'sideBarTab');
DivSideBar. The appendChild (divSideBarTab);
Var h2=document. The createElement method (' h2);
DivSideBarTab. The appendChild (h2);
Var TXT=document. The createTextNode (' directory navigation);
H2. The appendChild (TXT);
Var divSideBarContents=document. The createElement method (' DIV ');
='none' divSideBarContents. Style. The display;
DivSideBarContents. SetAttribute (' id ', 'sideBarContents');
DivSideBar. The appendChild (divSideBarContents);
//to create a custom list
Var dlist=document. The createElement method (" dl ");
DivSideBarContents. The appendChild (dlist);
var num=0;//statistical find mt and st
nullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnull