简体   繁体   中英

Show Bulma Calendar extension with Speech balloon type not Modal type

On the official demonstration page, the default type of display styles shows a calendar with a speech balloon under the form, but using downloaded files and copied sources from the document, it shows a modal with a black background.

How to show the same appearance, a speech balloon style as the demo page?

https://creativebulma.net/product/calendar/demo#

Now: modal view

**HTML**
<input type="date">

**js**
// Initialize all input of type date
      var calendars = bulmaCalendar.attach('[type="date"]');

      // Loop on each calendar initialized
      for(var i = 0; i < calendars.length; i++) {
        // Add listener to date:selected event
        calendars[i].on('select', date => {
          console.log(date);
        });
      }

      // To access to bulmaCalendar instance of an element
      var element = document.querySelector('#my-element');
      if (element) {
        // bulmaCalendar instance is available as element.bulmaCalendar
        element.bulmaCalendar.on('select', function(datepicker) {
          console.log(datepicker.data.value());
        });
      }

Solved!

Just deleting this part in the 'bulma-calendar.js' not to make responsive style.

      // Force dialog display mode on mobile devices
  if (this.options.displayMode === 'default' && window.matchMedia('screen and (max-width: 768px)').matches) {
    this.options.displayMode = 'dialog';
  }
  if (window.matchMedia('screen and (max-width: 768px)').matches) {
    if (this.options.displayMode === 'default') {
      this.options.displayMode = 'dialog';
    }
    this.options.displayDual = false;
  }

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM