dist/bbn.js
/**
     * Resizes the environment by assigning it the effective height and width of the window.
     * @global   
     * @example 
     * ```javascript
     * bbn.fn.resize();
     * ```
     * @method   resize
     * @memberof bbn.fn
     */
Resizes the environment by assigning it the effective height and width of the window.
Resizes the environment by assigning it the effective height and width of the window .
resize(){
      let diffW = bbn.env.width !== window.innerWidth;
      let diffH = bbn.env.height !== window.innerHeight;
      if (diffW || diffH){
        if (diffW) {
          bbn.env.width = window.innerWidth || window.document.documentElement.clientWidth || window.document.body.clientWidth;
          document.documentElement.style.setProperty('--vw', (bbn.env.width * 0.01) + 'px');
        }
        if (diffH) {
          bbn.env.height = window.innerHeight || window.document.documentElement.clientHeight || window.document.body.clientHeight;
          document.documentElement.style.setProperty('--vh', (bbn.env.height * 0.01) + 'px');
        }
        let smallWidth = bbn.fn.getCssVar('mobile-limit') || 650;
        let newCls = 'bbn-screen-' + (bbn.env.width < parseInt(smallWidth)  ? 'small' : 'regular');
        let classes = (document.body.className || '').split(' ');
        let done = false;
        bbn.fn.each(classes, (cls, idx) => {
          let bits = cls.split('-');
          if ((bits.length === 3) && (cls.indexOf('bbn-screen-') === 0)) {
            done = true;
            if (cls !== newCls) {
              classes.splice(idx, 1, newCls);
            }
            return false;
          }
        });
        if (!done) {
          classes.push(newCls);
        }
        document.body.className = classes.join(' ');
        bbn.fn.defaultResizeFunction();
      }
    }
resize ( ) { let diffW = bbn . env . width !== window . innerWidth ; let diffH = bbn . env . height !== window . innerHeight ; if ( diffW || diffH ) { if ( diffW ) { bbn . env . width = window . innerWidth || window . document . documentElement . clientWidth || window . document . body . clientWidth ; document . documentElement . style . setProperty ( '--vw' , ( bbn . env . width * 0.01 ) + 'px' ) ; } if ( diffH ) { bbn . env . height = window . innerHeight || window . document . documentElement . clientHeight || window . document . body . clientHeight ; document . documentElement . style . setProperty ( '--vh' , ( bbn . env . height * 0.01 ) + 'px' ) ; } let smallWidth = bbn . fn . getCssVar ( 'mobile-limit' ) || 650 ; let newCls = 'bbn-screen-' + ( bbn . env . width < parseInt ( smallWidth ) ? 'small' : 'regular' ) ; let classes = ( document . body . className || '' ) . split ( ' ' ) ; let done = false ; bbn . fn . each ( classes , ( cls , idx ) => { let bits = cls . split ( '-' ) ; if ( ( bits . length === 3 ) && ( cls . indexOf ( 'bbn-screen-' ) === 0 ) ) { done = true ; if ( cls !== newCls ) { classes . splice ( idx , 1 , newCls ) ; } return false ; } } ) ; if ( ! done ) { classes . push ( newCls ) ; } document . body . className = classes . join ( ' ' ) ; bbn . fn . defaultResizeFunction ( ) ; } }
Resizes the environment by assigning it the effective height and width of the window.
Resizes the environment by assigning it the effective height and width of the window .