Skip to content

Commit

Permalink
Updated mobile menu to more resemble the desktop menu
Browse files Browse the repository at this point in the history
  • Loading branch information
benjaminluck committed Jun 7, 2017
1 parent 5a5944f commit 30a934a
Show file tree
Hide file tree
Showing 6 changed files with 71 additions and 40 deletions.
2 changes: 1 addition & 1 deletion index.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<body>
<header>
<div class="menu-wrapper">
<div class="menu init float-left">
<div id="menu-elem" class="menu init float-left">
<ul>
<li><?= $info['release']; ?></li>
<li><?= $info['artist']; ?></li>
Expand Down
45 changes: 27 additions & 18 deletions js/components/InputController.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,18 @@ function detachIOEventListeners(){
window.removeEventListener( 'mousewheel', onMouseWheel, false );
}

menuElem = document.getElementById('menu-elem');
menuElem.addEventListener("touchstart", toggleMobileExpand, false);
trackInfoElem = document.getElementById('track-information');
trackInfoElem.addEventListener("touchstart", toggleMobileExpand, false);

function toggleMobileExpand(){
menuElem.classList.toggle('expand-mobile');
trackInfoElem.classList.toggle('expand-mobile');
}

function onWindowResize() {
camera.aspect = window.innerWidth / window.innerHeight;
camera.aspect = window.innerWidth / window.innerHeight;
camera.updateProjectionMatrix();
renderer.setSize( window.innerWidth, window.innerHeight );
}
Expand Down Expand Up @@ -65,29 +75,28 @@ function onTouchEnd(event){
function onTouchStart(event){
console.log(event);
if(event.targetTouches){
mouse.x = +(event.targetTouches[0].pageX / window.innerWidth) * 2 +-1;
mouse.y = -(event.targetTouches[0].pageY / window.innerHeight) * 2 + 1;

}else{
return false;
}
mouse.x = +(event.targetTouches[0].pageX / window.innerWidth) * 2 +-1;
mouse.y = -(event.targetTouches[0].pageY / window.innerHeight) * 2 + 1;
raycaster.setFromCamera( mouse, camera );

raycaster.setFromCamera( mouse, camera );
var intersects = raycaster.intersectObjects( scene.children[1].children, true);

var intersects = raycaster.intersectObjects( scene.children[1].children, true);
if ( intersects.length > 0 ) {
// alert(mesh.name);

if ( intersects.length > 0 ) {
// alert(mesh.name);
var mesh = intersects[0].object.parent;
if(mesh.name == 'Cylinder'){
moveToDownloadPage();
}
// console.log(intersects[0].object.parent)
// alert(mesh.name);
SoundManager.playTrackByName(mesh.name);

var mesh = intersects[0].object.parent;
if(mesh.name == 'Cylinder'){
moveToDownloadPage();
}
// console.log(intersects[0].object.parent)
// alert(mesh.name);
SoundManager.playTrackByName(mesh.name);

}
}else{
return false;
}
}

function onDocumentMouseDown( event ) {
Expand Down
4 changes: 2 additions & 2 deletions js/components/SoundManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ var SoundManager = (function () {

self.displayTrackName = function(){
var elemWrapper = document.getElementById("track-information");
elemWrapper.classList = 'track-information active';
elemWrapper.classList.toggle('active');
var elem = document.getElementById("track-info-text");
var trackTitle = self.songs[self.currentPlayingIndex].displayName;
elem.innerHTML = trackTitle;
Expand All @@ -42,7 +42,7 @@ var SoundManager = (function () {
console.log(sounds);
sounds.forEach(function(sound, index){
if(sound.title){
if(self.songs[index]){
if(self.songs[index]){
self.songs[index].displayName = sound.title;
}
}
Expand Down
29 changes: 18 additions & 11 deletions styles/css/style.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion styles/css/style.css.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

29 changes: 22 additions & 7 deletions styles/css/style.scss
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
@import 'mixins/mediaqueries';
$menu-nav-width: 198px;
$menu-nav-expand: 283px;

html {
overflow: hidden;
Expand Down Expand Up @@ -49,7 +50,7 @@ body {
}

.track-information{
transition: height 0.3s ease;
transition: height 0.3s ease, top 0.3s ease, width 0.3s ease;
height: 0px;
position: absolute;
z-index: 5;
Expand All @@ -64,6 +65,14 @@ body {
background-color: black;
border: none;


&.expand-mobile{
@include mobile-only{
width: $menu-nav-expand;
top:88px;
}
}

#actions{
opacity: 0;
margin-top:-17px;
Expand Down Expand Up @@ -226,7 +235,7 @@ body {

.menu {
overflow: hidden;
transition: width 1s;
transition: width 0.3s, height 0.3s ease;
z-index: 2;
top: 25px;
left: 25px;
Expand All @@ -236,11 +245,16 @@ body {
width: $menu-nav-width;
height: 31px;
&:hover {
width: 575px;
height: 31px;
@include mobile-landscape-and-up {
width: 575px;
height: 31px;
}
}

&.expand-mobile{
@include mobile-only{
width: $menu-nav-width;
width: $menu-nav-expand;
height: 63px;
}
}
ul {
Expand All @@ -263,8 +277,9 @@ body {
margin-left: -10px;
border-right: 1px solid black;
padding-left: 15px;
/* color: white;
background-color: #000; */
@include mobile-only{
border-right: none;
}
}
display: inline-block;
list-style-type: none;
Expand Down

0 comments on commit 30a934a

Please sign in to comment.