2

I have been trying to get this to work for a while now to no avail. Either I manage to break the whole page or it simply doesn't do anything.

script:

$(document).ready(function(){
    var height = $(window).innerHeight();
    $('a[id="st2"]:target~#scrollbg article.panel').css('-webkit-transform','translateY(-'height'px)');

});

trying to change the value of this css class:

a[id="st2"]:target~#scrollbg article.panel {
    -webkit-transform: translateY(-955px);
    transform: translateY(-955px);
}   

(the -955 value comes from me having manually entered the value so that it works in my browser/screen res.)

Now I'm well aware that I could just scrap the whole css-animation and do everything in javaScript instead but I still thought that I'd try asking for help first.

Cheers,

/chok

4
  • should a[id="st2"] not be: a#st2 ? Commented Feb 25, 2014 at 13:49
  • @nico #st2 is enough. Commented Feb 25, 2014 at 14:01
  • @FabrizioCalderan that is correct of course. Commented Feb 25, 2014 at 14:02
  • Thanks for confirming this as well, I thought of changing it but let it be while fixing the "real" issue to reduce the amount of possible errors in the code. Commented Feb 25, 2014 at 14:07

1 Answer 1

5
'translateY(-'height'px)');

should be

'translateY(-'+height+'px)');

Note the +. Otherwise, it ends up being a syntax error.

Sign up to request clarification or add additional context in comments.

2 Comments

Yes that's exactly it! Thank's a lot mate.
@Chokladio - No worries.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.