Class Image
Define a Image block to be displayed into a JBlocks.
- Defined in: jblocks.block.image.js
- Extends Block
Constructor Attributes | Constructor Name and Description |
---|---|
Image()
An Image block displays an image. |
Method Summary
Class Detail
Image()
An Image block displays an image.
The constructor should not be invoked directly but JBlocks#newBlock or JBlocks#addNewBlock should be used instead.
Method Detail
-
init(layout, options)Initializes an Image block. The method is invoked by the jBlocks core and must never be called directly.
- Parameters:
- {Object} layout Optional
- see Block#init.
- {Object} options Optional
- in addition to base class options Block#init:
- {String} options.src Optional
- the URL of the image to be displayed.
- {String} options.stretch Optional, Default: "keep-ratio"
- describes the way the image is resized according to the block size:
- full-extend: the image size is set to match the block one, regardless of the ratio.
- keep-ratio: the image is set to maximum size fitting inside the block, while keeping its ratio.
- no-oversampling: like keep-ratio but the image is not stretched over its original size.
- {String} options.onClick Optional
- a function to be called when the image is clicked.