Update the trail description to be with the other tabs.
adding a script for 'Show more' 'Show less'
}
/* Member Tabs */
#trail_main_btn,
+#trail_descr_btn,
#trail_guide_btn,
#trail_facilities_btn,
#trail_directions_btn,
font-weight: bold;
cursor: pointer;
}
+.showLess {
+ height: 150px;
+ overflow: hidden;
+ margin: 0 0 10px;
+}
+.showMore {
+ height: available;
+ overflow: visible;
+}
#trail_main_btn:hover,
+#trail_descr_btn:hover,
#trail_guide_btn:hover,
#trail_facilities_btn:hover,
#trail_directions_btn:hover,
-moz-box-shadow: inset 0 0 10px rgba(176,164,135,.7);
box-shadow: inset 0 0 10px rgba(176,164,135,.7);*/
}
-#trail_guide {
+#trail_descr {
padding: 20px;
margin: 0;
width: 100%;
box-shadow: inset 0 0 10px rgba(176,164,135,.7);
display: block;
}
+#trail_guide,
#trail_facilities,
#trail_directions,
#trail_hours,
box-shadow: inset 0 0 10px rgba(176,164,135,.7);
display: none;
}
+#trail_descr_btn.current,
#trail_guide_btn.current,
#trail_facilities_btn.current,
#trail_directions_btn.current,
#trail_information_btn.current {
color: #F7931E;
}
-#trail_desc {
- clear: left;
-}
#member-img-1 {
padding-right:0;
border-radius: 6px;
+<style>
+.show-more {
+ padding: 10px 0;
+ text-align: center;
+}
+.short-text {
+ overflow: hidden;
+ height: 8em;
+}
+
+.full-text{
+ height: auto;
+}
+</style>
<flexy:toJavascript
flexy:prefix="glm_"
base_url="base_url"
<div flexy:if="difficulty"><b>Difficulty:</b> {difficulty:h}</div>
</div>
</div><!-- /.vcard -->
- <div id="trail_desc" flexy:if="description"><h1 style="font-size: 18px;">Trail Description</h1>{description:h}</div>
</div><!--/#top_wrapper-->
- <div id="trail_guide_btn" flexy:if="guide" class="current">Guide</div>
+ <div id="trail_descr_btn" flexy:if="description" class="current">Trail Description</div>
+ <div id="trail_guide_btn" flexy:if="guide" class="">Guide</div>
<div id="trail_facilities_btn" flexy:if="facilities" class="">Facilities</div>
<div id="trail_directions_btn" flexy:if="directions" class="">Directions</div>
<div id="trail_hours_btn" flexy:if="hours" class="">Hours & fees</div>
<div id="trail_information_btn" flexy:if="information" class="">Information</div>
+ <div id="trail_descr" flexy:if="description">
+ <h1 style="font-size: 18px;">Trail Description</h1>
+ <div class="text-content short-text">
+ {description:h}
+ </div>
+ <div class="show-more">
+ <a href="#">Show more</a>
+ </div>
+ </div>
<div id="trail_guide" flexy:if="guide">
<h2>Trail Guide: </h2>{guide:h}
</div>
</div>
<script type="text/javascript">
$(document).ready(function() {
+ $(".show-more a").each(function() {
+ var $link = $(this);
+ var $content = $link.parent().prev("div.text-content");
+
+ console.log($link);
+
+ var visibleHeight = $content[0].clientHeight;
+ var actualHide = $content[0].scrollHeight - 1;
+
+ console.log(actualHide);
+ console.log(visibleHeight);
+
+ if (actualHide > visibleHeight) {
+ $link.show();
+ } else {
+ $link.hide();
+ }
+ });
+
+ $(".show-more a").on("click", function() {
+ var $link = $(this);
+ var $content = $link.parent().prev("div.text-content");
+ var linkText = $link.text();
+
+ $content.toggleClass("short-text, full-text");
+
+ $link.text(getShowLinkText(linkText));
+
+ return false;
+ });
+
+ function getShowLinkText(currentText) {
+ var newText = '';
+
+ if (currentText.toUpperCase() === "SHOW MORE") {
+ newText = "Show less";
+ } else {
+ newText = "Show more";
+ }
+
+ return newText;
+ }
$("#member-logo1").fancybox({
helpers: {
title: {
currentNav();
// Add Click Handlers for the tab buttons.
- //$("#trail_main_btn").click(function() {
- // trailTabs(this);
- //});
+ $("#trail_descr_btn").click(function() {
+ trailTabs(this);
+ });
$("#trail_guide_btn").click(function() {
trailTabs(this);
});
//alert(clickedLink.id);
// Clear all currents.
- //$("#trail_main_btn").removeClass('current');
+ $("#trail_descr_btn").removeClass('current');
$("#trail_guide_btn").removeClass('current');
$("#trail_facilities_btn").removeClass('current');
$("#trail_directions_btn").removeClass('current');
// Hide all tab content.
//$("#top_wrapper").css('display', 'none');
+ $("#trail_descr").css('display', 'none');
$("#trail_guide").css('display', 'none');
$("#trail_facilities").css('display', 'none');
$("#trail_directions").css('display', 'none');
$("#trail_information").css('display', 'none');
// Set this as current.
- if (clickedLink.id == "trail_guide_btn") {
+ if (clickedLink.id == "trail_descr_btn") {
+ $("#trail_descr_btn").addClass('current');
+ $("#trail_descr").css('display', 'block');
+ } else if (clickedLink.id == "trail_guide_btn") {
$("#trail_guide_btn").addClass('current');
$("#trail_guide").css('display', 'block');
} else if (clickedLink.id == "trail_facilities_btn") {