• Resolved Morris Gilles

    (@morris-gilles)


    Hi,

    I’m using your plugin to pull up my social icons (#advanced_floating_content_637) at the end of each post which works great. But now the social icons are already visible when the page is loaded. Before using the plugin, the social icons would only become visible upon scrolling down (after 350px). Is there any way to call the .scrollTop() function of the floating content? I tried adding this:

    $(document).scroll(function() {
      var y = $(this).scrollTop();
      if (y > 350) {
        $("#advanced_floating_content_637").fadeIn();
      } else {
        $("#advanced_floating_content_637").fadeOut();
      }
    });

    to no avail. Any ideas on how I could achieve that the element fades in after scrolling down? Best, MP

    The page I need help with: [log in to see the link]

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter Morris Gilles

    (@morris-gilles)

    hi again,

    ok, I fixed the problem. Apparently the plugin I used cloned the element, so I was using the wrong selector. So this is the final code:

                    (function ($) {                
    jQuery(window).on("load resize scroll",function(e){
                            var y = jQuery(this).scrollTop();   
                if (y > 350) {
                var str = jQuery.cookie("afc_clicked");               
                if(str==""){
                     jQuery("#advanced_floating_content_637.advanced_floating_content.sticky-element-cloned").css('opacity', 1);
                }        
        }else{
            jQuery("#advanced_floating_content_637.advanced_floating_content.sticky-element-cloned").css('opacity', 0);
        }
    });
                    })(jQuery);

    Hi, thanks for trying my plugin! ??

    I wasn’t really sure what your issue was to be honest, but I’m glad you managed to figure it out and find a fix.

    Please let me know if there is anything else!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘show or hide div depending on scoll position’ is closed to new replies.