nexpected "foreach" keyword after "@" character. Once inside code, you do not need to prefix constructs like "foreach" with "@".
Line 39: @: delay: 8000,
Line 40: @: backgrounds: [
Line 41: @foreach (var mediaID in mediaID1){ Line 42: var media = umbraco.uQuery.GetMedia(mediaID);
Line 43: @:{src: '@media.GetImageUrl()', fade: slidefade }
Jonas: The error said it clearly.. next time, read the error message twice and try to think about it for couple of seconds.. Maybe it will be much quicker then writing into the forums and waiting for the reply. Just my advice. ;)
@ Smajl, you're right, I should have checked the error message more carefully.
@ Fuji: Sorry I have not responded, had to go away for a while. It still does not work, I get no error message but no images.Getting error in firebug that slidefade is not defined. Have tried to define it but have not really gotten it to work. But I get the correct paths to the images, so that bit works.
Final code:
@{
var mediaID1 = Model.Content.GetProperty("images").Value.ToString().Split(',');
@: var slidefade = 2000;
@:$.vegas('slideshow', {
@: delay: 8000,
@: backgrounds: [
foreach (var mediaID in mediaID1){
var media = umbraco.uQuery.GetMedia(mediaID);
@:{src: '@media.GetImageUrl()', fade: slidefade },
}
@:]
@:})('overlay')
}
Edit: I got it work now! Thank you so much for your help Fuji!
Need help with slideshow
Hi,
I have a full screen slideshow on the front page in javascript, and would like to use multiple media picker to pick my images for the slideshow.
The javascript code:
var slidefade = 2000
I use multiple media picker in my portfolio, and it works well but I do not know how to code when it comes to scripting.
//Jonas
Hi Jonas
In your cshtml file do something like this for your js to work
Thanks, but I get this error
nexpected "foreach" keyword after "@" character. Once inside code, you do not need to prefix constructs like "foreach" with "@".
Line 39: @: delay: 8000, Line 40: @: backgrounds: [ Line 41: @foreach (var mediaID in mediaID1){ Line 42: var media = umbraco.uQuery.GetMedia(mediaID); Line 43: @:{src: '@media.GetImageUrl()', fade: slidefade }
Remove the @ sign before the foreach.
Jonas: The error said it clearly.. next time, read the error message twice and try to think about it for couple of seconds.. Maybe it will be much quicker then writing into the forums and waiting for the reply. Just my advice. ;)
@ Jonas: Did you get it working ?
@ Smajl, you're right, I should have checked the error message more carefully.
@ Fuji: Sorry I have not responded, had to go away for a while. It still does not work, I get no error message but no images.Getting error in firebug that slidefade is not defined. Have tried to define it but have not really gotten it to work. But I get the correct paths to the images, so that bit works.
Final code:
Edit: I got it work now! Thank you so much for your help Fuji!
Great if you got it working.
is working on a reply...