Index: trunk/extensions/SemanticResultFormats/Gallery/SRF_Gallery.php |
— | — | @@ -35,10 +35,7 @@ |
36 | 36 | static $carouselNr = 0; |
37 | 37 | |
38 | 38 | // Set attributes for jcarousel |
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. |
| 39 | + $dataAttribs = array( |
43 | 40 | 'wrap' => 'both', // Whether to wrap at the first/last item (or both) and jump back to the start/end. |
44 | 41 | 'vertical' => 'false', // Orientation: vertical = false means horizontal |
45 | 42 | 'rtl' => 'false', // Directionality: rtl = false means ltr |
— | — | @@ -46,13 +43,23 @@ |
47 | 44 | |
48 | 45 | // Use perrow parameter to determine the scroll sequence. |
49 | 46 | if ( empty( $this->params['perrow'] ) ) { |
50 | | - $attribs['scroll'] = 1; // default 1 |
| 47 | + $dataAttribs['scroll'] = 1; // default 1 |
51 | 48 | } else { |
52 | | - $attribs['scroll'] = $this->params['perrow']; |
53 | | - $attribs['visible'] = $this->params['perrow']; |
| 49 | + $dataAttribs['scroll'] = $this->params['perrow']; |
| 50 | + $dataAttribs['visible'] = $this->params['perrow']; |
54 | 51 | } |
| 52 | + |
| 53 | + $attribs = array( |
| 54 | + 'id' => 'carousel' . ++$carouselNr, |
| 55 | + 'class' => 'jcarousel jcarousel-skin-smw', |
| 56 | + 'style' => 'display:none;', // Avoid js loading issues by not displaying anything until js is able to do so. |
| 57 | + ); |
| 58 | + |
| 59 | + foreach ( $dataAttribs as $name => $value ) { |
| 60 | + $attribs['data-' . $name] = $value; |
| 61 | + } |
55 | 62 | |
56 | | - $ig->setAttributes( $mAttribs ); |
| 63 | + $ig->setAttributes( $attribs ); |
57 | 64 | |
58 | 65 | // Load javascript module |
59 | 66 | SMWOutputs::requireResource( 'ext.srf.jcarousel' ); |
Index: trunk/extensions/SemanticResultFormats/Gallery/resources/ext.srf.jcarousel.js |
— | — | @@ -13,7 +13,7 @@ |
14 | 14 | |
15 | 15 | // Bind individual elements containing class jcarousel as the plug-in |
16 | 16 | // requires different id's |
17 | | - $(".jcarousel").each(function() { |
| 17 | + $( '.jcarousel' ).each( function() { |
18 | 18 | var $this = $( this ); |
19 | 19 | |
20 | 20 | // Display carousel only after js is loaded and is ready otherwise display=none |
— | — | @@ -21,11 +21,11 @@ |
22 | 22 | |
23 | 23 | // Call the jcarousel plug-in |
24 | 24 | $this.jcarousel( { |
25 | | - scroll: parseInt( $this.attr( 'scroll' ), 10 ), // Number of items to be scrolled |
26 | | - visible: parseInt( $this.attr( 'visible' ), 10 ), // calculated and set visible elements |
27 | | - wrap: $this.attr( 'wrap' ), // Options are "first", "last", "both" or "circular" |
28 | | - vertical: $this.attr( 'vertical' ) === 'true', // Whether the carousel appears in horizontal or vertical orientation |
29 | | - rtl: $this.attr( 'rtl' ) === 'true' // Directionality |
| 25 | + scroll: parseInt( $this.attr( 'data-scroll' ), 10 ), // Number of items to be scrolled |
| 26 | + visible: parseInt( $this.attr( 'data-visible' ), 10 ), // calculated and set visible elements |
| 27 | + wrap: $this.attr( 'data-wrap' ), // Options are "first", "last", "both" or "circular" |
| 28 | + vertical: $this.attr( 'data-vertical' ) === 'true', // Whether the carousel appears in horizontal or vertical orientation |
| 29 | + rtl: $this.attr( 'data-rtl' ) === 'true' // Directionality |
30 | 30 | } ); |
31 | 31 | } ); |
32 | 32 | |