vendredi 24 juillet 2015

If Else JQuery error

I've edited a wordpress, woocommerce js file successfully. However when I try to change the standard scroll function to first check the browser width, it fails with an unexpected token ( error. I can't see where the problem is and I've tried rewriting it several ways. Code I'm trying is:

// Scroll to top
    $( 'html, body' ).animate( {
if( $(window).width() < 680 ) {
   scrollTop: ( $( 'form.checkout' ).offset().top - 100 )
}, 1000;
else {
   scrollTop: ( $( 'form.checkout' ).offset().top - 170 )
}, 1000;
                    }

Aucun commentaire:

Enregistrer un commentaire