ka215 / jquery.timeline

You can easily create the horizontal timeline with two types by using this jQuery plugin.
MIT License
240 stars 43 forks source link

Highlight weekends on ruler #49

Closed robibuckley closed 3 years ago

robibuckley commented 4 years ago

Hi, I have a timeline and have the scale set as 'day' - I was wondering how I could possibly highlight weekends (Saturday and Sunday) on the ruler? (bold / different background etc)

Or conversely, highlight workdays?

Is there any way to achieve this?

ka215 commented 4 years ago

Hi there,

Yes, you can do that. You should add custom styles like below in your CSS file.

/* for Saturday style */
.jqtl-ruler-line-item[data-ruler-item^="weekday-"][data-ruler-item$=",6"] {
  background-color: rgba(51,51,247,.08);
}
/* for Sunday style */
.jqtl-ruler-line-item[data-ruler-item^="weekday-"][data-ruler-item$=",0"] {
    background-color: rgba(247,51,51,.08);
}

CSS attribute selectors for weekday on the ruler is as follows:

Then if you want to bold string in the ruler item;

.jqtl-ruler-line-item[data-ruler-item^="weekday-"] span {
    font-weight: 600;
}

Please try it.

Thank you,