mirror of
https://github.com/e107inc/e107.git
synced 2025-08-06 14:46:56 +02:00
Use Library Manager to load libraries. Use JS behaviors. Add "Order images by" pref.
This commit is contained in:
49
e107_plugins/gallery/js/gallery.cycle.js
Normal file
49
e107_plugins/gallery/js/gallery.cycle.js
Normal file
@@ -0,0 +1,49 @@
|
||||
var e107 = e107 || {'settings': {}, 'behaviors': {}};
|
||||
|
||||
(function ($)
|
||||
{
|
||||
|
||||
/**
|
||||
* Behavior to initialize gallery slideshow.
|
||||
*
|
||||
* @type {{attach: Function}}
|
||||
*/
|
||||
e107.behaviors.galleryCycle = {
|
||||
attach: function (context, settings)
|
||||
{
|
||||
$(context).find("#gallery-slideshow-content").once('gallery-slideshow-content').each(function ()
|
||||
{
|
||||
$(this).cycle({
|
||||
fx: settings.gallery.fx,
|
||||
next: '.gal-next',
|
||||
prev: '.gal-prev',
|
||||
speed: settings.gallery.speed, // speed of the transition (any valid fx speed value)
|
||||
timeout: settings.gallery.timeout,
|
||||
slideExpr: '.slide',
|
||||
pause: 1, // pause on hover - TODO pref
|
||||
activePagerClass: '.gallery-slide-jumper-selected',
|
||||
before: function (currSlideElement, nextSlideElement, options, forwardFlag)
|
||||
{
|
||||
var nx = $(nextSlideElement).attr('id').split('item-');
|
||||
var th = $(currSlideElement).attr('id').split('item-');
|
||||
$('#gallery-jumper-' + th[1]).removeClass('gallery-slide-jumper-selected');
|
||||
$('#gallery-jumper-' + nx[1]).addClass('gallery-slide-jumper-selected');
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$(context).find(".gallery-slide-jumper").once('gallery-slide-jumper').each(function ()
|
||||
{
|
||||
$(this).click(function ()
|
||||
{
|
||||
var nid = $(this).attr('id');
|
||||
var id = nid.split('-jumper-');
|
||||
var go = parseInt(id[1]) - 1;
|
||||
$('#gallery-slideshow-content').cycle(go);
|
||||
return false;
|
||||
});
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
})(jQuery);
|
28
e107_plugins/gallery/js/gallery.js
Normal file
28
e107_plugins/gallery/js/gallery.js
Normal file
@@ -0,0 +1,28 @@
|
||||
var e107 = e107 || {'settings': {}, 'behaviors': {}};
|
||||
|
||||
(function ($)
|
||||
{
|
||||
|
||||
/**
|
||||
* Behavior to initialize prettyPhoto on gallery elements.
|
||||
*
|
||||
* @type {{attach: Function}}
|
||||
*/
|
||||
e107.behaviors.gallery = {
|
||||
attach: function (context, settings)
|
||||
{
|
||||
$(context).find("a[data-gal^='prettyPhoto']").once('gallery-prettyPhoto').each(function ()
|
||||
{
|
||||
$(this).prettyPhoto(
|
||||
{
|
||||
hook: 'data-gal',
|
||||
theme: 'pp_default', /* pp_default , light_rounded , dark_rounded , light_square , dark_square ,facebook */
|
||||
overlay_gallery: false,
|
||||
deeplinking: false
|
||||
}
|
||||
);
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
})(jQuery);
|
Reference in New Issue
Block a user