Skip to content

Latest commit

 

History

6 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 

Repository files navigation

Partial polyfill for Regions

This polyfill makes CSS3 Regions cross-browser and cross-platform. It uses binary search to find the position of the words, which makes it run really fast.

About CSS Regions

CSS regions allow content to flow across multiple areas called regions. These regions are not necessarily contiguous in the document order.

Basic setup

var reg = new Regions(document.getElementById('article'));
reg.flowTo(document.getElementById('part_2'));
reg.flowTo(document.getElementById('part_3'));
reg.flowTo(document.getElementById('part_4'));
reg.split();

Chaining

(new Regions(document.getElementById('article'))).
  flowTo(document.getElementById('part_2')).
  split();

Events

  var reg = new Regions(document.getElementById('article'));

    reg.requestNewRegion = function() {
      var region = document.createElement('div');
      region.className = 'region';
      document.body.appendChild(region);
      this.flowTo(region);
    }

    reg.requestRemoveRegion = function(region) {
      this.removeRegion(region);
      region.parentNode.removeChild(region);
    }

    reg.split();

  }

jQuery build-in plugin

$('.article').region('flowTo', $('.article_part'));

Checking native support for CSS3 Regions

if (!Regions.nativeSupport()) {
  $('.article').region('flowTo', $('.article_part'));
}

About

A partial polyfill for CSS3 Regions

Resources

Stars

20 stars

Watchers

4 watching

Forks

Releases

Packages

Contributors

Languages