mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-11-16 21:13:23 +01:00
Add two options to blueimp gallery plugin:
- thumbnailsTagIndicators: in order to set custom tag as indicator element. Default value: 'li' - thumbnailWithImgTag: in order to set indicator with img child as thumbnail. Default value: false
This commit is contained in:
parent
e673858e40
commit
dd7b4dec55
@ -38,7 +38,11 @@
|
|||||||
// used as alternative to a thumbnail child element:
|
// used as alternative to a thumbnail child element:
|
||||||
thumbnailProperty: 'thumbnail',
|
thumbnailProperty: 'thumbnail',
|
||||||
// Defines if the gallery indicators should display a thumbnail:
|
// Defines if the gallery indicators should display a thumbnail:
|
||||||
thumbnailIndicators: true
|
thumbnailIndicators: true,
|
||||||
|
// The tag name of thumbnails indicators
|
||||||
|
thumbnailsTagIndicators: 'li',
|
||||||
|
//thumbnail with image tag
|
||||||
|
thumbnailWithImgTag: false
|
||||||
});
|
});
|
||||||
|
|
||||||
var initSlides = Gallery.prototype.initSlides,
|
var initSlides = Gallery.prototype.initSlides,
|
||||||
@ -51,7 +55,7 @@
|
|||||||
$.extend(Gallery.prototype, {
|
$.extend(Gallery.prototype, {
|
||||||
|
|
||||||
createIndicator: function (obj) {
|
createIndicator: function (obj) {
|
||||||
var indicator = this.indicatorPrototype.cloneNode(false),
|
var indicator = this.indicatorPrototype.cloneNode(this.options.thumbnailWithImgTag),
|
||||||
title = this.getItemProperty(obj, this.options.titleProperty),
|
title = this.getItemProperty(obj, this.options.titleProperty),
|
||||||
thumbnailProperty = this.options.thumbnailProperty,
|
thumbnailProperty = this.options.thumbnailProperty,
|
||||||
thumbnailUrl,
|
thumbnailUrl,
|
||||||
@ -64,9 +68,20 @@
|
|||||||
thumbnailUrl = this.getItemProperty(obj, thumbnailProperty);
|
thumbnailUrl = this.getItemProperty(obj, thumbnailProperty);
|
||||||
}
|
}
|
||||||
if (thumbnailUrl) {
|
if (thumbnailUrl) {
|
||||||
|
if (this.options.thumbnailsTagIndicators == 'img')
|
||||||
|
{
|
||||||
|
indicator.src = thumbnailUrl;
|
||||||
|
}
|
||||||
|
else if (this.options.thumbnailWithImgTag)
|
||||||
|
{
|
||||||
|
indicator.children[0].src = thumbnailUrl;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
indicator.style.backgroundImage = 'url("' + thumbnailUrl + '")';
|
indicator.style.backgroundImage = 'url("' + thumbnailUrl + '")';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if (title) {
|
if (title) {
|
||||||
indicator.title = title;
|
indicator.title = title;
|
||||||
}
|
}
|
||||||
@ -100,7 +115,8 @@
|
|||||||
this.options.indicatorContainer
|
this.options.indicatorContainer
|
||||||
);
|
);
|
||||||
if (this.indicatorContainer.length) {
|
if (this.indicatorContainer.length) {
|
||||||
this.indicatorPrototype = document.createElement('li');
|
this.indicatorPrototype = document.createElement(this.options.thumbnailsTagIndicators);
|
||||||
|
if (this.options.thumbnailWithImgTag) this.indicatorPrototype.appendChild(document.createElement('img'));
|
||||||
this.indicators = this.indicatorContainer[0].children;
|
this.indicators = this.indicatorContainer[0].children;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue
Block a user