Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
Hi,
I have a web page which has a slideshow image background.
I load the slideshow with the following code:
$(document).bgStretcher({ images: ['images/bg1.jpg', 'images/bg2.jpg', 'images/bg3.jpg', 'images/bg4.jpg' ], imageWidth: $(window).width(), imageHeight: $(window).height() });
I would like to populate the images property from a media picker, which the editor will populate.
Any one have a suggestion on how to do this? I'm a little lost TBH.
Thank you!
Hi Elad,
You can either a XSLT Macro, or a Razor macro to render out the mark up you need.
Your template would be something like
$(document).bgStretcher({ images: [<umbraco:Macro Alias="getImages" runat="server"/>], imageWidth: $(window).width(), imageHeight: $(window).height()});
Rich
I have done several sites in Umbraco, but still find myself not looking in the right places...
I'm now stuck on the XSLT :(
This is what I have going, but it's not outputing anything:
<xsl:param name="currentPage"/> <xsl:template match="/imageList/multi-url-picker"> <xsl:for-each select="/url-picker"> <xsl:variable name="url"><xsl:value-of select="./url" /></xsl:variable> <xsl:value-of select="concat('"', $url, '"')" /> </xsl:for-each> </xsl:template>
Hey Elad,
First things first, you need to be using a data type that allows mutiple selections of images, something like uComponents MultiNodeTreePicker or DAMP.
Which datatype are you using?
I used the multi URL picker. I got it working.
Here is the XSLT code, for future generations :)
<xsl:param name="currentPage"/><xsl:template match="/"> <xsl:apply-templates select="$currentPage/ancestor-or-self::ContentPages/imageList/multi-url-picker" /></xsl:template> <xsl:template match="url-picker"> <xsl:variable name="url"><xsl:value-of select="./url" /></xsl:variable> <xsl:value-of select="concat('"', $url, '",')" /> </xsl:template>
Nice work, glad you got it working :)
is working on a reply...
This forum is in read-only mode while we transition to the new forum.
You can continue this topic on the new forum by tapping the "Continue discussion" link below.
Continue discussion
media picker in to javascript
Hi,
I have a web page which has a slideshow image background.
I load the slideshow with the following code:
$(document).bgStretcher({
images: ['images/bg1.jpg', 'images/bg2.jpg', 'images/bg3.jpg', 'images/bg4.jpg' ], imageWidth: $(window).width(), imageHeight: $(window).height() });
I would like to populate the images property from a media picker, which the editor will populate.
Any one have a suggestion on how to do this? I'm a little lost TBH.
Thank you!
Hi Elad,
You can either a XSLT Macro, or a Razor macro to render out the mark up you need.
Your template would be something like
$(document).bgStretcher({
images: [<umbraco:Macro Alias="getImages" runat="server"/>], imageWidth: $(window).width(), imageHeight: $(window).height()});
Rich
Thank you!
I have done several sites in Umbraco, but still find myself not looking in the right places...
I'm now stuck on the XSLT :(
This is what I have going, but it's not outputing anything:
<xsl:param name="currentPage"/>
<xsl:template match="/imageList/multi-url-picker">
<xsl:for-each select="/url-picker">
<xsl:variable name="url"><xsl:value-of select="./url" /></xsl:variable>
<xsl:value-of select="concat('"', $url, '"')" />
</xsl:for-each>
</xsl:template>
Hey Elad,
First things first, you need to be using a data type that allows mutiple selections of images, something like uComponents MultiNodeTreePicker or DAMP.
Which datatype are you using?
Rich
I used the multi URL picker. I got it working.
Here is the XSLT code, for future generations :)
<xsl:param name="currentPage"/>
<xsl:template match="/">
<xsl:apply-templates select="$currentPage/ancestor-or-self::ContentPages/imageList/multi-url-picker" />
</xsl:template>
<xsl:template match="url-picker">
<xsl:variable name="url"><xsl:value-of select="./url" /></xsl:variable>
<xsl:value-of select="concat('"', $url, '",')" />
</xsl:template>
Nice work, glad you got it working :)
is working on a reply...
This forum is in read-only mode while we transition to the new forum.
You can continue this topic on the new forum by tapping the "Continue discussion" link below.