Correction de code

Fermé
kush91170 Messages postés 57 Date d'inscription mercredi 8 janvier 2014 Statut Membre Dernière intervention 22 juillet 2015 - 5 mars 2015 à 20:17
Bonjour à tous,

J'ai récupéré le code JS d'un ami qui s'y connait plutôt bien, cependant il ne s'applique pas bien sur mon site web (onepage), je pense qu'il s'agit de la syntaxe mais je ne suis pas sur et j'avoue que je suis assez naze dans ce langage. Si vous pouviez regarder ça et me dire ce que vous en pensez ça serait vraiment cool :

parallaxScroll = () =>
  currentScrollPosition = $(this).scrollTop()
  $('.opening').css
    'background-position' : '50% ' + ( -currentScrollPosition / 4 ) + 'px'
  $('.openingText').css
    'margin-top' : ( currentScrollPosition / 4 ) + "px"
    'opacity' : 1 - ( currentScrollPosition / 250 )

$(document).ready =>
  $(window).scroll =>
    parallaxScroll()
  $(document).scroll =>
    windowTop = $(window).scrollTop()
    bottomOfOpening = $('.opening').position().top + $('.opening').height()
    header = $('.header')
    windowHeight = $(window).height()
    compareWindowHeight = ( windowHeight - 70 ) + "px"
    if (bottomOfOpening > windowTop) 
      header.css
        'position' : 'absolute'
        'top'      : '100%'
        'left'     : '0'
    else
      header.css
        'position' : 'fixed'
        'top'      : '0'
        'left'     : '0'


Merci d'avance ! :)