Question

I am using Kentico 6 and am trying to convert the jQuery supersized plugin (full screen background slide show) into a web part so that editors will be able to choose the images that will be included in the slide show.

I'd rather not use a web part repeater that will list the selected images in the HTML and then let the script handle the rest due to the fact that the images are large and this will greatly affect the page load time. The plugin does a good job of optimizing the load time by loading the images from an array rather than loading all the images at once when the page loads.

What I would like to do is pass an array of user selected images to the javascript function that initiates the slide show. What is the best way to do this? Is it possible to do so with transformation?

Was it helpful?

Solution

I don' think there's any reason why you couldn't use a Repeater to load items into a JavaScript array.

<script type="text/javascript">

// array declaration
var data = [];

// Could use CMS:CMSRepeater here if needed
<asp:repeater id="rpt" runat="server">
<itemtemplate>
data.push( '<%#Eval("PathToImage")%>' );
</itemtemplate>

// call your function and pass the array or however you need to do it
superSizeFunction( data );

</asp:repeater>

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top