Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Peter Alcock 113 posts 176 karma points
    Dec 16, 2011 @ 10:11
    Peter Alcock
    0

    Fading image carousel titles

    Hi all,

    I have a fading image carousel (code below) where it pulls the images from my umbraco field image1 etc, i want it to also display a title for each image also pulled from a umbraco field (title1) but am struggling!

    Anyone have any suggestions??

    <?xml version="1.0" encoding="utf-8"?>
    <!DOCTYPE xsl:stylesheet [
            <!ENTITY nbsp "&#x00A0;">

    ]>
    <xsl:stylesheet
           
    version="1.0"
           
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
           
    xmlns:msxml="urn:schemas-microsoft-com:xslt"
           
    xmlns:umbraco.library="urn:umbraco.library"
           
    exclude-result-prefixes="msxml umbraco.library">
           
    <xsl:output method="xml" omit-xml-declaration="yes"/>

           
    <xsl:param name="currentPage"/>

           
    <xsl:template match="/">
                   
    <xsl:apply-templates select="$currentPage" />
           
    </xsl:template>

           
    <xsl:template match="*" />

           
    <xsl:template match="WidgetFadeImageCarousel">
                   
    <script type="text/javascript">
                            jQuery
    .PictureSlides.set({
                                   
    // Switches to decide what features to use
                                    useFadingIn
    : true,
                                    useFadingOut
    : true,
                                    useFadeWhenNotSlideshow
    : true,
                                    useFadeForSlideshow
    : true,
                                    useDimBackgroundForSlideshow
    : false,
                                    loopSlideshow
    : true,
                                    usePreloading
    : true,
                                    useAltAsTooltip
    : true,
                                    useTextAsTooltip
    : false,

                                   
    // Fading settings
                                    fadeTime
    : 500, // Milliseconds
                                    timeForSlideInSlideshow
    : 2000, // Milliseconds

                                   
    // At page load
                                    startIndex
    : 1,
                                    startSlideShowFromBeginning
    : true,
                                    startSlideshowAtLoad
    : true,
                                    dimBackgroundAtLoad
    : false,

                                   
    // Large images to use and thumbnail settings
                                    images
    : [
     <xsl:for-each select="umbraco.library:Split('image1,image2,image3,image4,image5,image6,image7,image8,image9,image10', ',')/value"> <xsl:variable name="value" select="text()" /> <xsl:if test="normalize-space($currentPage/*[name() = $value])"> <xsl:variable name="image" select="umbraco.library:GetMedia($currentPage/*[name() = $value], 0)" /> <xsl:if test="$image/umbracoFile"> { image : '<xsl:value-of select="$image/umbracoFile"/>', alt : '<xsl:value-of select="$image/@nodeName"/>', text : '<xsl:value-of select="$image/@nodeName"/>' } <xsl:if test="position() != last()">,</xsl:if> </xsl:if> </xsl:if> </xsl:for-each>
                                    ],
                                    thumbnailActivationEvent : "click",

                                    /
    / Classes of HTML elements to use
                                    mainImageClass
    : "picture-slides-image", // Mandatory
                                    fadeContainerClass
    : "picture-slides-fade-container"
                           
    });
                   
    </script>

                   
    <div id="container">
                           
    <div id="picture-slides-frame">
                                   
    <div class="picture-slides-container">
                                           
    <div class="picture-slides-fade-container">
                                                   
    <img class="picture-slides-image" width="680px" height="310px" src="about:blank" alt="This is pictur" />
                                           
    </div>
                                   
    </div>
                           
    </div>

                   
    </div>
           
    </xsl:template>

    </xsl:stylesheet>
  • awm 187 posts 376 karma points
    Dec 19, 2011 @ 12:34
    awm
    0

    What's actually happening, are you having trouble pulling out the images? Or is the slideshow not displaying properly?

  • Peter Alcock 113 posts 176 karma points
    Dec 19, 2011 @ 12:36
    Peter Alcock
    0

    Hi Alimac,

    The images are displaying perfectly, what i want is to also display text at the bottom of each image, i have created the fields named title1 up to 10 so would like image1 to display title1 at the bottom image2 display title2 and so on?

    Hopefully makes more sense!

    Thanks

    Pete

  • awm 187 posts 376 karma points
    Dec 20, 2011 @ 10:59
    awm
    0

    Hi Pete,

    I think I understand what you're trying to do but it looks as though it's going to be very difficult using your current setup. It looks as though you have 12 title properties on your document type? Creating another twelve fields for matching titles may not be the cleanest solution. It may be a better idea to allow your document to have child slide documents (which each have a title/image). It's then be far easier to loop through with XSLT and pull out these fields.

    Does this make sense? 

    If all else fails, I wrote something similar to this but using a .NET user control - you're welcome to use it if you like..

    Al

  • Peter Alcock 113 posts 176 karma points
    Dec 20, 2011 @ 12:25
    Peter Alcock
    0

    Hi Alimac,

    Thanks for the reply, right ok i did think of trying to do it like that just wasnt sure how to call each individual template(child node of carousel) in the jquery? If at all possible could you post or email me your usercontrol code i wouldnt mind seing some alternatives!

    Cheers again

    Pete

  • awm 187 posts 376 karma points
    Dec 20, 2011 @ 13:11
    awm
    0

    Sure, if you give me your email I'll mail it over (had a hard time trying to paste the code into the editor!).

  • Peter Alcock 113 posts 176 karma points
    Dec 20, 2011 @ 13:14
    Peter Alcock
    0

    Thanks alimac, my email is [email protected]

Please Sign in or register to post replies

Write your reply to:

Draft