lundi 27 février 2017

Pass random value in HTML-Style

I need to pass a random number in a HTMl Style that is attached to a figure which rotates. I am unable to do so even after trying hard. Following is the code which I wrote but no effect.

 <script>
    @ViewBag.angle  = ( Math.floor(Math.random()* (5 - 1)+1))+deg;
 </script
 <style>
   keyframes service-level{100%{transform:rotateZ(@ViewBag.angle);}}    
 </style>

If I use below code with static value it works fine. Please advise.

 keyframes service-level{100%{transform:rotateZ(90deg);}}   




Aucun commentaire:

Enregistrer un commentaire