Section 2 Page 1

Submitted by webteam_admin on Mon, 10/28/2019 - 15:37

This is Section 2 Page 2 example with <pre><code></code></pre>


(function($, slider) {
  'use strict';
  slider.current_section = 1;
  slider.current_page = 1;
  slider.slider_id = "slide";
  slider.getCurrentMaxNumberOfPage = function() {
    return this.config['section'+this.current_section].number_of_page;
  }

  slider.next = function() {
    if (this.current_page  1) {
      this.current_page--;
    } else {
      if (this.current_section == 1) {
        this.current_section = this.numberOfSection;
      } else {
        this.current_section--;
      }
      this.current_page = this.getCurrentMaxNumberOfPage();
    }
    this.updateSlide();
  }

  slider.updateSlide = function() {
    var url = "/orientation/get-slide?section=" + this.current_section + '&page=' + this.current_page;
    $.get(url, function(data) {
      $("#" + slider.slider_id).html(data.message);
    })
    .fail(function() {
      $("#" + slider.slider_id).html("Failed to get next slide!");
    })
    .always(function() {
      slider.updateProgressBar();
    });
  }

  slider.updateProgressBar = function() {
    const percentage = slider.current_page / slider.getCurrentMaxNumberOfPage() * 100;
    $("#progress-bar-label").text("Section " + this.current_section + " Progress");
    $("#progress-bar .progress-bar").attr("aria-valuenow", percentage).css("width", percentage + "%").text(percentage + "% of Section " + this.current_section);
  }
  // for (var i = 0; i 
Section Number
2
Page Number
1