Copied to clipboard

Flag this post as spam?

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


  • Jon 47 posts 290 karma points
    Jun 29, 2016 @ 14:41
    Jon
    0

    Dynamic styling syntax NEWBIE

    I am trying to set background-images on my parallax site...and i've got to issues here...

    1. Because of the tags {} [] I guess it makes problems - how to solve?

    2. Some kind og if or ucase for the first and count for the rest. How?

    THX!

    [data-animation="parallax"] .cd-section:first-of-type > div, [data-animation="fixed"] .cd-section:first-of-type > div, [data-animation="opacity"] .cd-section:first-of-type > div {
      background-image: url("@imagePath");
    }
    [data-animation="parallax"] .cd-section:nth-of-type(2) > div, [data-animation="fixed"] .cd-section:nth-of-type(2) > div, [data-animation="opacity"] .cd-section:nth-of-type(2) > div {
      background-image: url("@imagePath");
    }
    [data-animation="parallax"] .cd-section:nth-of-type(3) > div, [data-animation="fixed"] .cd-section:nth-of-type(3) > div, [data-animation="opacity"] .cd-section:nth-of-type(3) > div {
      background-image: url("@imagePath");
    }
    
  • Alex Skrypnyk 6163 posts 24143 karma points MVP 8x admin c-trib
    Jun 29, 2016 @ 21:32
    Alex Skrypnyk
    0

    Hi Jon,

    What exactly wrong with your code?

    What error?

    Thanks

  • Alex Skrypnyk 6163 posts 24143 karma points MVP 8x admin c-trib
    Jul 03, 2016 @ 10:02
    Alex Skrypnyk
    0

    Hi Jon,

    Did you solve the problem ?

    Thanks

  • Søren Kottal 712 posts 4570 karma points MVP 6x c-trib
    Jul 03, 2016 @ 19:53
    Søren Kottal
    0

    Hi Jon

    You can do like this

    @Html.Raw("[data-animation=\"parallax\"] .cd-section:nth-of-type(3) > div, [data-animation="\fixed\"] .cd-section:nth-of-type(3) > div, [data-animation=\"opacity\"] .cd-section:nth-of-type(3) > div {")
      background-image: url("@imagePath");
    @Html.Raw("}")
    

    That way, the brackets will not be interpreted as c#

Please Sign in or register to post replies

Write your reply to:

Draft