Support » Plugin: Share This Image » Problem with shares icon and fixed menu

  • Resolved robert784

    (@robert784)


    Hi!

    I got stuck on problem with this plugin for last few days.
    Whenever I set to show share button on hover it show on top of page.
    There is css for that:

    .sti.sti-hover {
    z-index: 9999999999999999;
    }

    Unfortunatly if I set z-index lower than 1000 then share buttons just disapper. And setting sticky menu to higher value than is in .sti.sti-hover has no effect. Has anyone encountered this problem?

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author ILLID

    (@mihail-barinov)

    Hello,

    Can you please give me te link where I can see this issue?

    Regards

    Thread Starter robert784

    (@robert784)

    Yeah, sure.
    Here is the link:
    http://voila.edu.pl/jezyk-francuski/#1615488455746-ac7a9ed8-496e

    The site is old and still need a lot of works, but for now I need this widget whitch looks great except that issue.

    Plugin Author ILLID

    (@mihail-barinov)

    Looks like I found the solution for you. But you will need to make some changes in the plugin source code. I will add the same changes to the next plugin release so don’t worry about this changes lost after the plugin update.

    So please open share-this-image/assets/js/sti.js file. Find line

    var stiBoxSingleSelector = '';

    and replace with

    var stiBoxSingleSelector = '';
    
    		var appendButtonsTo = StiHooks.apply_filters( 'sti_append_buttons_to', 'body' );

    Also find line

    if ( ! $('#'+stiBoxSingleSelector).length ) {
    					$('body').append('<div id="'+stiBoxSingleSelector+'" class="sti sti-top sti-hover style-flat-small" style="display: none;"><div class="sti-share-box">' + methods.shareButtons() + '</div></div>');
    				}

    and replace it with

    if ( ! $('#'+stiBoxSingleSelector).length ) {
    					$(appendButtonsTo).append('<div id="'+stiBoxSingleSelector+'" class="sti sti-top sti-hover style-flat-small" style="display: none;"><div class="sti-share-box">' + methods.shareButtons() + '</div></div>');
    				}

    So after just use following code snippet:

    add_action( 'wp_enqueue_scripts', 'sti_wp_enqueue_scripts', 9999999 );
    function sti_wp_enqueue_scripts() {
        $script = "
            function sti_append_buttons_to( selector ) {
                return '.content';
            }
           StiHooks.add_filter( 'sti_append_buttons_to', sti_append_buttons_to );
        ";
        wp_add_inline_script( 'sti-script', $script);
    }

    You need to add it somewhere outside the plugins folder. For example, inside functions.php file of your theme or use some plugin for adding code snippets.

    Regards

    Thread Starter robert784

    (@robert784)

    WOW! Thank you so much πŸ˜€ It works perfect now πŸ˜€ I didn’t expect such a quick and good answer, and I’m very grateful πŸ˜€ You do a great works πŸ˜€ Thank you!

    I see that now the code is generated inside the content and not at the end of body like before. I thought that could be a problem but I didn’t know how to fix it, so one again thank you.

    All the best!

    • This reply was modified 8 months, 2 weeks ago by robert784.
    Plugin Author ILLID

    (@mihail-barinov)

    Glad to help.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Problem with shares icon and fixed menu’ is closed to new replies.