Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiple share buttons with different urls #251

Open
ghost opened this issue Nov 3, 2015 · 5 comments
Open

Multiple share buttons with different urls #251

ghost opened this issue Nov 3, 2015 · 5 comments
Assignees

Comments

@ghost
Copy link

ghost commented Nov 3, 2015

There is any way to have multiple sharebuttons in a page with different urls? (use case: a page with multiple articles and you want to provide a share buttons for every single article)
It would be nice if it would be possible to add a data attribute to the tag that overrides the default url defined in the configuration.

@juanitoddd
Copy link

I am having the same question

@aproxis
Copy link

aproxis commented Dec 7, 2015

I've combined sharing buttons this with infinite scroll on one of my Shopify projects.
Here's how it looks like:

$('.wrapper').infinitescroll({
    navSelector: ".nextNav",
    nextSelector: "a.next",
    itemSelector: ".article",
    loading: {
        finishedMsg: "<em>You've reached the end of the Internet.</em>",
        speed: 'fast',
    }
}, function(infiniteSharingButtons) {
    new Share(".share-button", {
        ui: {
            flyout: "bottom left",
            button_font: false,
            button_text: 'Share'
        },
        networks: {
            facebook: {
                before: function(element) {
                    this.url = element.getAttribute("data-url");
                },
                load_sdk: false
            }
        }
    });
});

and in html it looks like this:

<div class="share-button" data-url="http://www.yourwebsite.com/article1234"></div>

@bgaillard
Copy link

Hi, we also need this, it seems that @aproxis solution does not work as expected in our case because :

  • If you have for example 5 buttons on the same page then their will be 5 clickbindings, after that if we click on one button it seems the click callbacks are called 5 times for a button ;
  • In consequence this opens the sharing windows several times by clicking on a button, for exemple in our cas the Twitter sharing dialog is opened 2 times.

Is their any workaround do display several share buttons on the same page ?

@svsdesign
Copy link

+1

@iamtiz
Copy link

iamtiz commented Aug 1, 2016

+1, it would be extremely useful

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants