Skip to content

1.1.6

Compare
Choose a tag to compare
@optimalisatie optimalisatie released this 01 Jun 08:33
· 45 commits to master since this release

Added: option to force inview event on element using 1 as inview handler: $lazy("[selector]", 1);
Added: z event name to enable manually triggering of inview event on elements. (when using click extension)

// load all images before printing
window.onbeforeprint = function() {

	// get all applicable elements by using an empty inview handler
	var images = $lazy('[data-z]', function() {});

	// fire `z` event on images
	if (images) {
		images.forEach(function(i) {
			try {
		        var EventName = 'z';
		        if( i.fireEvent ) {
		            i.fireEvent( 'on' + EventName );     
		        } else {   
		            var evObj = document.createEvent( 'Events' );
		            evObj.initEvent( EventName, true, false );
		            i.dispatchEvent( evObj );
		        }
		    } catch (e) {

		    }
		});
	}
};