Skip to content

Commit

Permalink
Issue 24, refactor click function for toggling meetup views
Browse files Browse the repository at this point in the history
  • Loading branch information
itsevalieu committed Apr 24, 2019
1 parent 67dcc59 commit 72e6c0b
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 32 deletions.
18 changes: 5 additions & 13 deletions custom.js
Original file line number Diff line number Diff line change
Expand Up @@ -305,19 +305,11 @@

// Toggle between calendar and list views

$('.views').on('click', '.view', function() {
$(this).addClass('showing').siblings().removeClass('showing');

if (this.id === 'weekbutton') {
$('.listview').hide();
$('.weekview').show();
$('.dots').show();
}
if (this.id === 'listbutton') {
$('.weekview').hide();
$('.listview').show();
$('.dots').hide();
}
$('.viewLinks').on('click', '.viewLink', function() {
$('.viewLink').removeClass('active');
$('.view').removeClass('showing');
$(this).addClass('active');
$('.view.' + this.id ).addClass('showing');
});

// Click Event for Load More
Expand Down
28 changes: 15 additions & 13 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -36,23 +36,25 @@ <h2>Upcoming Events:</h2>

<div id="mapid"></div>

<div class='views'>
<span class='view showing' id='listbutton'>List View</span>
<span class='view' id='weekbutton'>Week View</span>
<div class='viewLinks'>
<a class='viewLink active' id='list'>List View</a>
<a class='viewLink' id='weekly'>Week View</a>
</div>

<div class='weekview slider'>
<button class='prev' onclick='plusSlides(-1)'>&#10094</button>
<button class='next' onclick='plusSlides(1)'>&#10095</button>
<div class='week slide fade' id='firstweek'></div>
<div class='week slide fade' id='secondweek'></div>
</div>
<div class='dots'>
<span class='dot' onclick='currentSlide(1)'></span>
<span class='dot' onclick='currentSlide(2)'></span>
<div class='view weekly'>
<div class='weekview slider'>
<button class='prev' onclick='plusSlides(-1)'>&#10094</button>
<button class='next' onclick='plusSlides(1)'>&#10095</button>
<div class='week slide fade' id='firstweek'></div>
<div class='week slide fade' id='secondweek'></div>
</div>
<div class='dots'>
<span class='dot' onclick='currentSlide(1)'></span>
<span class='dot' onclick='currentSlide(2)'></span>
</div>
</div>

<ul class="listview"></ul>
<div class='view list showing'><ul class="listview"></ul></div>

<p>Visit our <a href="https://www.meetup.com/LearnTeachCode/">Meetup.com page</a> for details on our next meetings.</p>

Expand Down
23 changes: 17 additions & 6 deletions style.css
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ body {

a {
color: #b74949;
cursor: pointer;
}

h1 {
Expand Down Expand Up @@ -96,17 +97,28 @@ section {
}
.view {
padding: 5px;
display: none;
}
.viewLinks {
width: 100%;
padding: 5px;
margin: 25px 0;
}
.viewLink {
padding: 5px;
color: #000;
}
.viewLink:hover, .viewLink.active {
color: rgba(183, 73, 73);
text-decoration: underline;
}
.showing {
color: rgba(183, 73, 73);;
transform: scale(1.015);
display: block;
}


/** WEEK VIEW **/
.weekview {
position: relative;
display: none;
min-height: 250px;
}
.week {
Expand Down Expand Up @@ -263,7 +275,6 @@ section {
}

.dots {
display: none;
text-align: center;
padding: 15px;
}
Expand All @@ -278,7 +289,7 @@ section {
transition: background-color 0.6s ease;
}

.active, .dot:hover {
.dot:hover, .dot.active {
background-color: #717171;
}

Expand Down

0 comments on commit 72e6c0b

Please sign in to comment.