ilkeryilmaz / timelinejs

🎬 jQuery timeline plugin, easily creates timeline slider.
https://ilkeryilmaz.github.io/timelinejs/
882 stars 119 forks source link

Make it responsive solution #11

Closed rewrite123 closed 5 years ago

rewrite123 commented 5 years ago

Just replace your timeline.css with this and your timeline will be responsive for displays that are <=450 pixels ;P

@charset "UTF-8"; /*! Timeline - v0.0.2 ilker Yılmaz & greenman/rewrite123 https://github.com/ilkeryilmaz/timeline */ NEW STUFF: Now it resizes at displays that are 450 pixels */ .timeline-container { position: relative; } .timeline-container::after { content: ''; display: table; clear: both; } .timeline { width: 100%; } .timeline-list { position: relative; width: 100%; overflow: hidden; margin: 0; padding: 0; } .timeline-list-wrap { position: relative; top: 0; left: 0; display: block; transform: translate3d(0, 0, 0); transition: transform 1s cubic-bezier(0.455, 0.03, 0.515, 0.955); } .timeline-item { float: left; width: 800px; height: 400px; border: 1px solid #ddd; box-sizing: border-box; } .timeline-dots-wrap { position: absolute; overflow: hidden; } .timeline-horizontal .timeline-dots-wrap { width: 100%; height: 35px; } .timeline-vertical .timeline-dots-wrap { width: 65px; height: 100%; top: 0; } .timeline-dots-wrap.bottom { bottom: -50px; } .timeline-dots-wrap.top { top: -50px; } .timeline-dots-wrap.left { left: -65px; } .timeline-dots-wrap.right { right: -70px; } .timeline-dots { margin: 0; padding: 0; position: relative; width: 100%; height: 100%; transition: transform 1s cubic-bezier(0.455, 0.03, 0.515, 0.955); } .timeline-horizontal .timeline-dots { background: url("../img/timeline-bg.png") bottom repeat-x; } .timeline-vertical .timeline-dots { background: url("../img/timeline-vertical-bg.png") left repeat-y; } .timeline-dots li { transition: all 1s cubic-bezier(0.455, 0.03, 0.515, 0.955); list-style: none; overflow: hidden; } .timeline-horizontal .timeline-dots li { float: left; width: 50px; text-align: center; } .timeline-vertical .timeline-dots li { width: 100%; } .timeline-dots li.slide-active button { color: #2972ca; font-size: 15px; } .timeline-dots button { cursor: pointer; border: none; outline: none; color: #333; font-size: 12px; transition: all 1s cubic-bezier(0.455, 0.03, 0.515, 0.955); } .timeline-horizontal .timeline-dots button { background: url("../img/date-icon.png") bottom no-repeat; padding-bottom: 15px; } .timeline-vertical .timeline-dots button { background: url("../img/date-icon-vertical.png") left no-repeat; padding-left: 15px; } .timeline-container { width: 800px; margin: 0 auto; } .timeline-list { width: 800px; } .timeline-item { width: 800px; height: 400px; padding: 10px; border: 1px solid #ddd; } ``` / FROM HERE ON OUT IS NEW! / .timeline-background{ background-repeat: no-repeat; background-size: cover; background-position: center; height: 100%; padding: 0px; margin: 0px; border: 0px; } .timeline-vertical-center{ min-height: 100%; display: flex; align-items: center; } @media (max-width:450px){ .timeline-container { position: relative; } .timeline-container::after { content: ''; display: table; clear: both; } .timeline { width: 100%; } .timeline-list { position: relative; width: 100%; overflow: hidden; margin: 0; padding: 0; } .timeline-list-wrap { position: relative; top: 0; left: 0; display: block; transform: translate3d(0, 0, 0); transition: transform 1s cubic-bezier(0.455, 0.03, 0.515, 0.955); } .timeline-item { float: left; width: 350px; height: 400px; border: 1px solid #ddd; box-sizing: border-box; } .timeline-dots-wrap { position: absolute; overflow: hidden; } .timeline-horizontal .timeline-dots-wrap { width: 100%; height: 35px; } .timeline-vertical .timeline-dots-wrap { width: 45px; height: 100%; top: 0; } .timeline-dots-wrap.bottom { bottom: -50px; } .timeline-dots-wrap.top { top: -50px; } .timeline-dots-wrap.left { left: -65px; } .timeline-dots-wrap.right { right: -70px; } .timeline-dots { margin: 0; padding: 0; position: relative; width: 100%; height: 100%; transition: transform 1s cubic-bezier(0.455, 0.03, 0.515, 0.955); } .timeline-horizontal .timeline-dots { background: url("../img/timeline-bg.png") bottom repeat-x; } .timeline-vertical .timeline-dots { background: url("../img/timeline-vertical-bg.png") left repeat-y; } .timeline-dots li { transition: all 1s cubic-bezier(0.455, 0.03, 0.515, 0.955); list-style: none; overflow: hidden; } .timeline-horizontal .timeline-dots li { float: left; width: 40px; text-align: center; } .timeline-vertical .timeline-dots li { width: 100%; } .timeline-dots li.slide-active button { color: #2972ca; font-size: 15px; } .timeline-dots button { cursor: pointer; border: none; outline: none; color: #333; font-size: 12px; transition: all 1s cubic-bezier(0.455, 0.03, 0.515, 0.955); } .timeline-horizontal .timeline-dots button { background: url("../img/date-icon.png") bottom no-repeat; padding-bottom: 15px; } .timeline-vertical .timeline-dots button { background: url("../img/date-icon-vertical.png") left no-repeat; padding-left: 15px; } .timeline-container { width: 350px; margin: 0 auto; } .timeline-list { width: 350px; } .timeline-item { width: 350px; height: 400px; padding: 10px; border: 1px solid #ddd; } }```

EXAMPLE: Uses a little bootstrap for centering text and a few other things, but this template can work with a little bit of elbow grease ;P

<div class="timeline-container timeline-theme-1" id="idHandler"> <div class="timeline js-timeline"> <div data-time="2011" id="timeline-clicker"> <div class="timeline-background" style="background-image: url(IMAGE_GOES_HERE.jpg);"> <div class="timeline-vertical-center" style="width: 100%;"> <div class="text-center text-white" style="width: 100%;"> <h3><strong>TEXT GOES HERE</strong></h3> </div> </div> </div> </div> </div> </div>

ilkeryilmaz commented 5 years ago

Hi,

Thank you for your support. But you must send your updates as a pull request.

Thank you.