I need a unique id on each instance of my partial and the included parallax script. This way the script only starts the effect when reaching the bounds of that specific element. Is there built-in functionality in umbraco that could help me out ?
The result should look like this, in short, where the -165160 is generated, yet the same for script and div.
<div class="infoblock-165160">
...
</div>
<script>
var rellax = new Rellax('.rellaximage', {
wrapper: 'infoblock-165160';
...
}
</script>
@{
// take the first block of a GUID
string id = Guid.NewGuid().ToString().Split('-')[0];
}
<div class="infoblock-@id">
...
</div>
<script>
var rellax = new Rellax('.rellaximage', {
wrapper: 'infoblock-@id';
...
}
</script>
Simple unique id for div
Hi,
New to umbraco, razor and c.
I need a unique id on each instance of my partial and the included parallax script. This way the script only starts the effect when reaching the bounds of that specific element. Is there built-in functionality in umbraco that could help me out ?
The result should look like this, in short, where the -165160 is generated, yet the same for script and div.
Grts,
Hi Tobias,
Thanks a lot for your reply and the insight! Works like a charm!
Grts,
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.