Remark: Progress bar instead of slide numbers

Created on 5 Feb 2018  路  4Comments  路  Source: gnab/remark

Is it possible to add a progress bar instead of slide numbers?

For example, this progress bar at the bottom from reveal.js.

screenshot 2018-02-05 15 36 20

feature

Most helpful comment

This is quite simple to emulate.

In your CSS, add:

    .remark-slide-number {
      position: inherit;
    }

    .remark-slide-number .progress-bar-container {
      position: absolute;
      bottom: 0;
      height: 2px;
      display: block;
      left: 0;
      right: 0;
    }

    .remark-slide-number .progress-bar {
      height: 100%;
      background-color: red;
    }

Then in your remark options, use this slideNumberFormat:

    var slideshow = remark.create({
      slideNumberFormat: (current, total) => `
        <div class="progress-bar-container">
          <div class="progress-bar" style="width: ${current/total*100}%">
          </div>
        </div>
      `
    });

Hope that helps

All 4 comments

This is quite simple to emulate.

In your CSS, add:

    .remark-slide-number {
      position: inherit;
    }

    .remark-slide-number .progress-bar-container {
      position: absolute;
      bottom: 0;
      height: 2px;
      display: block;
      left: 0;
      right: 0;
    }

    .remark-slide-number .progress-bar {
      height: 100%;
      background-color: red;
    }

Then in your remark options, use this slideNumberFormat:

    var slideshow = remark.create({
      slideNumberFormat: (current, total) => `
        <div class="progress-bar-container">
          <div class="progress-bar" style="width: ${current/total*100}%">
          </div>
        </div>
      `
    });

Hope that helps

@saul Do you think you could turn this into a PR as an option? "counter" would be the existing (default) way with slide numbers and "bar" would be what you've added.

var slideshow = remark.create({
  progressStyle: [ counter | bar ]
})

@utdrmac It should be possible to use both. [counter | bar | counter,bar].

This is a great feature, but: It there a way to have the progress bar and the slide numbers? This would be great, specially having the bar at the top and the numbers at the bottom, so far I have just managed to have the bar at the top,

.remark-slide-number {
  position: fixed;
  top: 0px;
  left: 0px;
}

.remark-slide-number .progress-bar-container {
  position: absolute;
  bottom: 10;
  height: 8px;
  display: block;
  left: 0;
  right: 0;
}

.remark-slide-number .progress-bar {
  height: 100%;
  background-color: red;
}
Was this page helpful?
0 / 5 - 0 ratings

Related issues

donquixote picture donquixote  路  5Comments

jklymak picture jklymak  路  8Comments

benjie picture benjie  路  4Comments

mikepqr picture mikepqr  路  6Comments

juanpabloaj picture juanpabloaj  路  3Comments