Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update website v1.6 - update get started page version dropdown #1

Merged
merged 2 commits into from
May 6, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 25 additions & 2 deletions versions/1.6/assets/js/options.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ $(document).ready(function () {
}
}

function setSelects(urlParams) {
function setSelects(urlParams, dontPushState) {
if (urlParams.get('version'))
versionSelect = urlParams.get('version');
$('.current-version').html( versionSelect + ' <span class="caret"></span>' );
Expand All @@ -68,7 +68,7 @@ $(document).ready(function () {

showContent();
let queryString = '?version=' + versionSelect + '&platform=' + platformSelect + '&language=' + languageSelect + '&environ=' + environSelect + '&processor=' + processorSelect
if (window.location.href.indexOf("/get_started") >= 0) {
if (window.location.href.indexOf("/get_started") >= 0 && !dontPushState) {
history.pushState(null, null, queryString);
}
}
Expand Down Expand Up @@ -107,5 +107,28 @@ $(document).ready(function () {
$('.opt-group').on('click', '.opt', setContent);
$('.install-widget').css("visibility", "visible");
$('.install-content').css("visibility", "visible");
$(window).on('popstate', function(){
setSelects(urlSearchParams(window.location.search), true);
});

let timer;
const toggleDropdown = function(showContent) {
if (timer) clearTimeout(timer);
if (showContent) {
timer = setTimeout(function() {
$(".version-dropdown").show()
}, 250);
} else {
$(".version-dropdown").hide()
}
}

$("#version-dropdown-container")
.mouseenter(toggleDropdown.bind(null, true))
.mouseleave(toggleDropdown.bind(null, false))
.click(function() {$(".version-dropdown").toggle()});

$("ul.version-dropdown").click(function(e) {
e.preventDefault();
});
});
43 changes: 43 additions & 0 deletions versions/1.6/assets/main.css
Original file line number Diff line number Diff line change
Expand Up @@ -1018,6 +1018,12 @@ figure {
li.opt.versions {
padding: 10px; }

li.opt.versions:hover {
background-color: #048ccc; }

li.opt.versions:hover a {
color: whitesmoke; }

.dropdown {
position: relative;
display: inline-block;
Expand Down Expand Up @@ -1055,6 +1061,43 @@ ul.dropdown-content {
.dropdown:hover .dropbtn {
background-color: #048ccc; }

ul.dropdown-content, ul.version-dropdown {
display: none;
position: absolute;
left: 40%;
text-align: center;
background-color: whitesmoke;
box-shadow: none;
z-index: 1;
margin: 0px;
padding: 0px;
list-style-type: none; }

ul.version-dropdown {
left: 0px;
width: 100%; }

.current-version.dropbtn.btn:focus {
outline: 0; }

.current-version .dropdown-caret {
position: relative;
top: 4px; }

.version-dropdown .active a {
color: whitesmoke; }

.version-dropdown a, .dropdown-content a {
color: #424242;
text-decoration: none;
display: block;
padding-left: 5px;
padding-right: 5px;
font-size: 17px; }

.version-dropdown a:hover, .dropdown-content a:hover {
color: orangered; }

/*
* selector
*/
Expand Down
11 changes: 8 additions & 3 deletions versions/1.6/get_started/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -173,9 +173,14 @@ <h2>Installing MXNet</h2>
<span>MXNet Version</span>
</div>
<div class="col-9 install-right">
<div class="dropdown">
<button class="current-version dropbtn btn" type="button" data-toggle="dropdown">v1.6.0</button>
<ul class="opt-group dropdown-content">
<div class="dropdown" id="version-dropdown-container">
<button class="current-version dropbtn btn" type="button" data-toggle="dropdown">
v1.6.0
<svg class="dropdown-caret" viewBox="0 0 32 32" class="icon icon-caret-bottom" aria-hidden="true">
<path class="dropdown-caret-path" d="M24 11.305l-7.997 11.39L8 11.305z"></path>
</svg>
</button>
<ul class="opt-group version-dropdown">
<li class="opt active versions"><a href="#">v1.6.0</a></li>
<li class="opt versions"><a href="#">v1.5.1</a></li>
<li class="opt versions"><a href="#">v1.4.1</a></li>
Expand Down