timeline_styles-8.x-1.x-dev/templates/timeline-styles-image.html.twig

templates/timeline-styles-image.html.twig
<style>
section {
  padding: 100px 0;
}

.vl {
  border-left: 6px solid grey;
  height: 100%;
  position: absolute;
  left: 50%;
  margin-left: -43px;
  top: 0;
}

h1 {
  font-size: 200%;
  text-transform: uppercase;
  letter-spacing: 3px;
  font-weight: 400;
}

header {
	background: $primary;
	color: $text;

	p {
		font-family: 'Allura';
		color: rgba(255, 255, 255, .2);
		margin-bottom: 0;
		font-size: 60px;
		margin-top: -30px;

	}
}

.timeline {

	position: relative;

	&::before {
		content: '';
		background: $light-primary;
		width: 5px;
		height: 95%;
		position: absolute;
		left: 50%;
		transform: translateX(-50%);
	}
}

/* css for making odd even card to left and right */

.timeline-item:nth-child(even) {
	width: 100%;
	margin-bottom: 70px;
  display: flex;
  justify-content: flex-end;
}
.timeline-item:nth-child(odd) {
	width: 100%;
	margin-bottom: 70px;
  display: flex;
  justify-content: flex-start;
  margin-left: -81px;
}


.timeline-content {
	position: relative;
	width: 50%;
	padding: 10px 30px;
	border-radius: 4px;
	background: #f5f5f5;
	box-shadow: 0 20px 25px -15px rgba(0, 0, 0, .3);

	&::after {
		content: '';
		position: absolute;
		border-style: solid;
		width: 0;
		height: 0;
		top: 30px;
		right: -15px;
		border-width: 10px 0 10px 15px;
		border-color: transparent transparent transparent #f5f5f5;
	}
}

.timeline-card {
	padding: 0!important;

	p {
		padding: 0 20px;
	}
}

.date {
	background: $accent;
	display: inline-block;
	color: $text;
	padding: 10px;
	position: absolute;
	top: 0;
	right: 0;
}

@media screen and (max-width: 768px) {

	.timeline {

		&::before {
			left: 50px;
		}


		.timeline-content {
			max-width: 100%;
			width: auto;
			margin-left: 70px;
		}

		.timeline-item {

			&:nth-child(even) {

				.timeline-content {
					float: none;

				}
			}

			&:nth-child(odd) {

				.timeline-content {
					&::after {
						content: '';
						position: absolute;
						border-style: solid;
						width: 0;
						height: 0;
						top: 30px;
						left: -30px;
						border-width: 10px 15px 10px 0;
						border-color: transparent #f5f5f5 transparent transparent;
					}
				}

			}
		}
	}
}

img.image-view {
    margin-top: -35px;
}

/* css for making dot in verticle line */

.timeline-item .timeline-content.js--fadeInLeft:after{
    content: '';
    position: absolute;
    background: grey;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    z-index: 99;
}

.timeline-item:nth-child(odd) .timeline-content.js--fadeInLeft:after{
    right: -54px;
    top: 25px;
}
.timeline-item:nth-child(even) .timeline-content.js--fadeInLeft:after{
    left: -53px;
    top: 25px;
}
</style>
<section class="timeline">
  <div class="container">
    {% for key, row in rows %}
      <div class="timeline-item">
        <div class="vl"></div>
        <div class="timeline-content js--fadeInLeft">
          <h2>{{ row.content['#row']._entity.title.value | raw }}</h2>
          <div class="date">{{ row.content['#row']._entity.field_timeline_styles_date.value | raw }}</div>
          <img class="image-view" src="{{ file_url(row.content['#row']._entity.field_timeline_styles_image.entity.uri.value) }}" />
          <p>{{ row.content['#row']._entity.body.value | raw }}</p>
        </div>
      </div>
    {% endfor %}
  </div>
</section>

Главная | Обратная связь

drupal hosting | друпал хостинг | it patrol .inc