SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Member
    Join Date
    Jul 2013
    Posts
    5
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Post Need help with Syntax

    Hi, i'm working on a 'back to top' button however I've already implemented the scroll back to the top and i only need the fade-in.

    $(function(){$(window).scroll(function(){if($(this).scrollTop()>100){$("#fixed-backtotop").fadeIn(1000)}else{$("#fixed-backtotop").fadeOut(750)}})};$("#fixed-backtotop").click(function(){$("html, body").animate({scrollTop:0},600);return false})});


    i want to remove the
    $("#fixed-backtotop").click(function(){$("html, body").animate({scrollTop:0},600);return false

    However, i can't get the syntax right, can anyone help ?

  2. #2
    Community Advisor bronze trophy
    fretburner's Avatar
    Join Date
    Apr 2013
    Location
    Brazil
    Posts
    1,405
    Mentioned
    45 Post(s)
    Tagged
    12 Thread(s)
    Like this, you mean?
    Code JavaScript:
    $(function(){
        $(window).scroll(function(){
            if($(this).scrollTop()>100){
                $("#fixed-backtotop").fadeIn(1000)
            } else {
                $("#fixed-backtotop").fadeOut(750)
            }
        })
    });

  3. #3
    SitePoint Member
    Join Date
    Jul 2013
    Posts
    5
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Works, thanks man !


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •