From: Anthony Talarico Date: Thu, 28 Dec 2017 20:17:05 +0000 (-0500) Subject: adding read more buttons to the event descriptions based on char count X-Git-Tag: v1.0.0^2~132 X-Git-Url: http://cvs2.gaslightmedia.com/gitweb/?a=commitdiff_plain;h=76f58df0c3c3a9d9549e18b3f97a469e32e15277;p=WP-Plugins%2Fglm-member-db-registrations.git adding read more buttons to the event descriptions based on char count hiding the rest of the descr if over a certain char count, adding styled button for read more --- diff --git a/css/front.css b/css/front.css index 75be001..38199d3 100644 --- a/css/front.css +++ b/css/front.css @@ -11,6 +11,31 @@ overflow: hidden; text-align: center; } +.glm-reg-event-descr{ + height: 46px; + overflow: hidden; + margin-bottom: 10px; +} +.glm-reg-event-descr-container{ + margin-bottom: 15px; +} +.glm-reg-read-more{ + border: 2px solid #55b776; + border-radius: 4px; + /* margin-left: .9735rem; */ + width: 120px; + background-color: white; + color: #55b776; + -webkit-transition: background-color .5s; + -moz-transition: background-color .5s; + transition: background-color .5s; +} +.glm-reg-read-more:hover{ + cursor: pointer; + background-color: #55b776; + color: white; + +} .glm-reg-map { width: 100%; margin: 0; @@ -158,7 +183,7 @@ word-wrap: break-word; } .glm-reg-event-profile-details:not(.glm-reg-contact-details){ - margin-bottom: 15px; + /* margin-bottom: 15px; */ } #glm-reg-map-container{ height: 0px; diff --git a/views/front/registrations/registration.html b/views/front/registrations/registration.html index e73a9d6..4c23429 100644 --- a/views/front/registrations/registration.html +++ b/views/front/registrations/registration.html @@ -76,26 +76,6 @@
- - {if $regEvent.eventDescr} -
-

Event Description

- {$regEvent.eventDescr} -
- {/if} - {if $regEvent.descr} -
-

Registration Details

- {$regEvent.descr} -
- {/if} - {if $regEvent.terms} -
-

Terms & Condtions

- {$regEvent.terms} -
- {/if} - {literal}
<% if ( this.getClassCount() == 0 ) { %> @@ -118,6 +98,47 @@
+ {/literal} +
+ + {if $regEvent.eventDescr} +
+

Event Description

+
+ {$regEvent.eventDescr} +
+ {if $regEvent.eventDescr|count_characters:true > 280} +
Read More
+ {/if} +
+ + {/if} + {if $regEvent.descr} +
+

Registration Details

+
+ {$regEvent.descr} +
+ {if $regEvent.descr|count_characters:true > 280} +
Read More
+ {/if} +
+ + {/if} + {if $regEvent.terms} +
+

Terms & Condtions

+
+ {$regEvent.terms} +
+ {if $regEvent.terms|count_characters:true > 280} +
Read More
+ {/if} +
+ + {/if} +
+ {literal}
You have not yet submitted your registration! @@ -497,7 +518,26 @@ jQuery(function($){ $(reg_class_detail).click(function() { $(this).parent().children(".reg-class-detail").slideToggle("fast", "swing", function() {}); $(this).parent().children(".reg-class-detail").toggleClass("collapsed"); - + }); + $('.glm-reg-read-more').on("click", function(){ + var id = $(this).data('descr'); + var descr = $('body').find( $('#' + id) ); + var descr_length = descr.text().length; + console.log(descr_length); + if( descr.height() < 47 && descr_length > 150 ){ + $(descr).animate({ + height: '100%', + }, function(){ + $(descr).css("overflow", "visible"); + }) + } else { + $(descr).animate({ + height: '46px', + }, function(){ + $(descr).css("overflow", "hidden"); + }) + } + }); });