• Resolved jamo_dodger

    (@jamo_dodger)


    Hello Max,

    This is not a problem with the plugin itself, but you may have an easy fix for me. I am a bit of a noob when it comes to javascript and I have installed your plugin to get a sidebar widget to stick to the top of the window when scrolled past.

    This has worked great so far however I have recently created another Div that appears upon scrolling. (similar to a mashable post page where the share buttons appear upon scrolling)

    I use the following javascript to get this to work:

    var $j = jQuery.noConflict();
    var startY = $j('.main-navigation').position().top + $j('.main-navigation').outerHeight();
    
    $j(window).scroll(function(){
        if( $j(this).scrollTop() > startY ){
            $j('.floating-share-bar').slideDown();
        }else{
            $j('.floating-share-bar').slideUp();
        }
    });

    This stops my sidebar widget from sticking and I presume it is because the plugin also uses .scrollTop.

    Any ideas on how I could overcome this?I know it is nothing to do with the plugin but it might be useful for this forum if others wanted to do something similar.

    James

    https://www.ads-software.com/plugins/q2w3-fixed-widget/

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

    (@jamo_dodger)

    PS. I have also tried checking the jQuery(window).load() hook option and this does make my widget stick. However it messes up the widget – I am using d4p-smashing-tabber with recent posts widgets in each tab and when I tick this box above the tabs display on top of one another.

    Any advice would be great

    James

    Thread Starter jamo_dodger

    (@jamo_dodger)

    Ok this is for anyone has actually understood what I said before.

    The problem was not with the plugin, or the JS used above. The problem was that when I loaded the script in my footer.php I used the following:

    <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1/jquery.js"></script>
    <script type="text/javascript" src="<?php bloginfo('template_url'); ?>/js/floating-share-bar.js"></script>

    The problem was being caused by the loading the googleapis jquery library. Once I had removed this everything works perfectly.

    James

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Cannot use this plugin with .scrollTop’ is closed to new replies.