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

Leti - Ampers - Trek #37

Open
wants to merge 12 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Added animated scrolling and hidden portions of code depending on eve…
…nts.
LetiTran committed May 29, 2018
commit e695efc9b29cfbe62243b76f27d2fe18eb4db0a9
23 changes: 19 additions & 4 deletions index.js
Original file line number Diff line number Diff line change
@@ -39,6 +39,12 @@ const loadTrips = () => {
reportStatus(`Encountered an error while loading trips: ${error.message}`);
console.log(error);
});


// Scrow to the bottom:
$('html, body').animate({scrollTop:$(document).height()/2}, 'slow');
// $(window).scrollTop($('#status-message').offset().top-20)

};

//______________________________________________________
@@ -55,6 +61,12 @@ const loadATrip = (tripID) => {
.then((response) => {
reportStatus(`Successfully loaded <strong>${response.data.name}</strong> trip details`);
// response.data.forEach((trip) => {

if (!response.data.about ) {
response.data.about = "No details available.";
}


tripDetails.append(`<h3>${response.data.name}</h3>
<div><h5>Continent</h5><p>${response.data.continent}</p></div>
<div><h5>Category</h5><p>${response.data.category}</p></div>
@@ -66,7 +78,7 @@ const loadATrip = (tripID) => {
// Trip name on the 'reserve trip' section:
// $('#trip-name').html(response.data.name);
$('#trip-id').html(response.data.id);
$('#makeReservation-button').val(`Reserve ${response.data.name} Trip!`)
$('#makeReservation-button').val(`Reserve '${response.data.name}' Trip!`)
})
.catch((error) => {
reportStatus(`Encountered an error while loading trips: ${error.message}`);
@@ -139,6 +151,9 @@ const loadATrip = (tripID) => {
// EVENTS:
$(document).ready(() => {

// Start page with focus on header, specifically on top button:
$(".top-button").focus();

// Load Trips:
$('#load').click(loadTrips);

@@ -160,9 +175,9 @@ const loadATrip = (tripID) => {
$(".cell.medium-auto.medium-cell-block-container").css("display", "contents");
});

// $('li.trip').on('click', function(event) {
// $(".trip-details").css("display", "contents");
// });
$('#trip-list').on('click', function(event) {
$(".make-reser-btn").css("display", "contents");
});


});