11 < nav class ="navbar navbar-default navbar-fixed-top " role ="navigation ">
2- < div class ="container ">
3- < div class ="navbar-header ">
2+ < div class ="nav- container ">
3+ < div class ="navbar-header " style =" width: 150px " >
44 < button type ="button " class ="navbar-toggle " data-toggle ="collapse " data-target =".navbar-ex1-collapse ">
55 < span class ="sr-only "> Toggle Navigation</ span >
66 < span class ="icon-bar "> </ span >
99 </ button >
1010 < a class ="navbar-brand " href ="{{ .Site.BaseURL}} "> {{ .Site.Title }}</ a >
1111 </ div >
12- < div class ="collapse navbar-collapse navbar-ex1-collapse ">
13- < ul class ="nav navbar-nav ">
12+
13+ < div class ="navbar-header " style ="width: calc(100% - 400px) ">
14+ < ul class ="nav navbar-nav " style ="width: 100% ">
1415 {{ range .Site.Menus.main }}
1516 < li > < a href ="{{.URL}} "> {{ .Name }}</ a > </ li >
1617 {{ end }}
17-
18- <!--
19- And here is where you'd add more links to sections, or anywhere you like.
20- <li><a href="#">About Me </a></li >
21- -- >
18+ < li class =" nav-item " >
19+ < a id =" dark-toggle " class =" dark-mode-toggle " aria-label =" dark-mode-toggle " style =" color: var(--Red); font-size: 20px " >
20+ < i class =" fas fa-sun " > </ i >
21+ </ a >
22+ </ li >
2223 </ ul >
23- < div id =" custom-search-input " class =" pull-right " >
24- < form class =" navbar-form " role =" search " method =" get " action =" https://www.bing.com/search " >
25- < div class =" input-group col-md-12 ">
26- < input type =" text " class ="form-control input-md " placeholder =" Search " name =" q " id =" srch-term ">
27- < input type =" hidden " name =" q1 " value =" site:sldn.softlayer.com " / >
28- < div class =" input-group-btn ">
29- < button class =" btn btn-info " type =" submit " >
30- < i class ="glyphicon glyphicon-search " > </ i >
31- </ button >
32- </ div >
33- </ div >
34- </ form >
24+ </ div >
25+
26+ < div id =" custom-search-input " class =" pull-right " style =" width: 250px ">
27+ < form class ="navbar-form " role =" search " method =" get " action =" https://www.bing.com/search ">
28+ < div class =" input-group col-md-12 " >
29+ < input type =" text " class =" form-control input-md " placeholder =" Search " name =" q " id =" srch-term ">
30+ < input type =" hidden " name =" q1 " value =" site:sldn.softlayer.com " / >
31+ < div class ="input-group-btn " >
32+ < button class =" btn btn-info " type =" submit " >
33+ < i class =" glyphicon glyphicon-search " > </ i >
34+ </ button >
35+ </ div >
3536 </ div >
37+ </ form >
3638 </ div >
39+
3740 </ div >
3841 </ nav >
42+
43+ < script type ="text/javascript ">
44+ const darkIconClass = 'fas fa-moon'
45+ const lightIconClass = 'fas fa-sun'
46+ var darkCSS = $ ( "#dark-theme" ) ;
47+ var darkToggleIcon = $ ( "#dark-toggle i" ) ;
48+
49+ // Set theme with the given mode and toggle the theme icon button
50+ // The button won't actually change for some reason on page load, will
51+ // change when its pressed though.
52+ function setThemeMode ( mode ) {
53+ localStorage . setItem ( "dark-mode-theme" , mode ) ;
54+ if ( mode === "dark" ) {
55+ darkToggleIcon . attr ( 'class' , darkIconClass )
56+ } else {
57+ darkToggleIcon . attr ( 'class' , lightIconClass )
58+ }
59+ }
60+
61+ // Toggle dark mode when user click on the icon button
62+ $ ( "#dark-toggle" ) . click ( function ( ) {
63+ if ( darkToggleIcon . attr ( "class" ) == lightIconClass ) {
64+ setThemeMode ( "dark" )
65+ } else if ( darkToggleIcon . attr ( "class" ) == darkIconClass ) {
66+ setThemeMode ( "light" )
67+ }
68+ location . reload ( ) ;
69+ } ) ;
70+ </ script >
0 commit comments