Index: trunk/extensions/SemanticResultFormats/Gallery/SRF_Gallery.php |
— | — | @@ -32,25 +32,24 @@ |
33 | 33 | $ig->setCaption( $this->mIntro ); // set caption to IQ header |
34 | 34 | |
35 | 35 | if ( $this->m_params['galleryformat'] == 'carousel' ) { |
| 36 | + static $carouselNr = 0; |
| 37 | + |
36 | 38 | // Set attributes for jcarousel |
37 | | - $mAttribs['id'] = 'carousel'; |
38 | | - $mAttribs['class'] = 'jcarousel-skin-smw'; |
| 39 | + $attribs = array( |
| 40 | + 'id' => 'carousel' . ++$carouselNr, |
| 41 | + 'class' => 'jcarousel jcarousel-skin-smw', |
| 42 | + 'style' => 'display:none;', // Avoid js loading issues by not displaying anything until js is able to do so. |
| 43 | + 'wrap' => 'both', // Whether to wrap at the first/last item (or both) and jump back to the start/end. |
| 44 | + 'vertical' => 'false', // Orientation: vertical = false means horizontal |
| 45 | + 'rtl' => 'false', // Directionality: rtl = false means ltr |
| 46 | + ); |
39 | 47 | |
40 | | - // Aoid js loading issues by not displaying anything until js is able to do so |
41 | | - $mAttribs['style'] = 'display:none;'; |
42 | | - |
43 | | - // Horizontal or vertical orientation |
44 | | - $mAttribs['orientation'] = 'horizontal'; |
45 | | - |
46 | | - // Whether to wrap at the first/last item (or both) and jump back to the start/end |
47 | | - $mAttribs['wrap'] = 'both'; |
48 | | - |
49 | | - // Use perrow parameter to determine the scroll sequence |
| 48 | + // Use perrow parameter to determine the scroll sequence. |
50 | 49 | if ( empty( $this->m_params['perrow'] ) ) { |
51 | | - $mAttribs['scroll'] = 1; // default 1 |
| 50 | + $attribs['scroll'] = 1; // default 1 |
52 | 51 | } else { |
53 | | - $mAttribs['scroll'] = $this->m_params['perrow']; |
54 | | - $mAttribs['visible'] = $this->m_params['perrow']; |
| 52 | + $attribs['scroll'] = $this->m_params['perrow']; |
| 53 | + $attribs['visible'] = $this->m_params['perrow']; |
55 | 54 | } |
56 | 55 | |
57 | 56 | $ig->setAttributes( $mAttribs ); |
Index: trunk/extensions/SemanticResultFormats/Gallery/resources/ext.srf.jcarousel.css |
— | — | @@ -4,7 +4,7 @@ |
5 | 5 | * @licence: GNU GPL v3 or later |
6 | 6 | * @author: mwjames and others |
7 | 7 | * |
8 | | - * @release: 0.1.2 |
| 8 | + * @release: 0.1.3 |
9 | 9 | */ |
10 | 10 | |
11 | 11 | .jcarousel-skin-smw .jcarousel-container { |
Index: trunk/extensions/SemanticResultFormats/Gallery/resources/ext.srf.jcarousel.js |
— | — | @@ -4,32 +4,34 @@ |
5 | 5 | * @licence: GNU GPL v3 or later |
6 | 6 | * @author: mwjames |
7 | 7 | * |
8 | | - * @release: 0.1 |
| 8 | + * @release: 0.1.3 |
9 | 9 | */ |
10 | 10 | |
11 | 11 | (function( $ ) { |
12 | 12 | |
13 | 13 | $( document ).ready( function() { |
14 | | - |
15 | | - var v_visible = parseInt($( '#carousel' ).attr( 'visible' ) ), |
16 | | - v_scroll = parseInt($( '#carousel' ).attr( 'scroll' ) ), |
17 | | - v_directionality = $( '#carousel' ).attr( 'directionality' ), |
18 | | - v_orientation = $( '#carousel' ).attr( 'orientation' ), |
19 | | - v_wrap = $( '#carousel' ).attr( 'wrap' ), |
20 | | - v_vertical = v_orientation === 'vertical', |
21 | | - v_rtl = v_directionality === 'rtl'; |
22 | 14 | |
23 | | - // Display carousel only after js is loaded and ready otherwise display=none |
24 | | - $( '#carousel').show(); |
25 | | - |
26 | | - // Call the jcarousel plug-in |
27 | | - $( '#carousel' ).jcarousel( { |
28 | | - scroll: v_scroll, // Number of items to be scrolled |
29 | | - visible: v_visible, // calculated and set visible elements |
30 | | - wrap: 'circular', // Whether to wrap at the first/last item (Options are "first", "last", "both" or "circular") |
31 | | - vertical: v_vertical, // Whether the carousel appears in horizontal or vertical orientation |
32 | | - rtl: v_rtl // Directionality |
33 | | - } ); |
| 15 | + // Bind individual elements containing class jcarousel as the plug-in |
| 16 | + // requires different id's |
| 17 | + $(".jcarousel").each(function() { |
| 18 | + var galleryId = "#" + $(this).closest(".jcarousel").attr("id"), |
| 19 | + v_vertical = ( $( this ).attr( 'vertical' ) === 'true'), // Value is either true or false |
| 20 | + v_rtl = ( $( this ).attr( 'rtl' ) === 'true'); // Value is either true or false |
| 21 | + //console.log(galleryId); |
| 22 | + |
| 23 | + // Display carousel only after js is loaded and is ready otherwise display=none |
| 24 | + $( this ).show(); |
| 25 | + |
| 26 | + // Call the jcarousel plug-in |
| 27 | + $( this ).jcarousel({ |
| 28 | + scroll: parseInt($( this ).attr( 'scroll' ) ), // Number of items to be scrolled |
| 29 | + visible: parseInt($( this ).attr( 'visible' ) ), // calculated and set visible elements |
| 30 | + wrap: $( this ).attr( 'wrap' ), // Options are "first", "last", "both" or "circular" |
| 31 | + vertical: v_vertical, // Whether the carousel appears in horizontal or vertical orientation |
| 32 | + rtl: v_rtl // Directionality |
| 33 | + } ); |
| 34 | + |
| 35 | + } ); |
34 | 36 | |
35 | 37 | } ); |
36 | 38 | |