patronage / bubs-timber

Gulp + Timber + WP
Other
5 stars 1 forks source link

Social Popups Code #30

Closed kylehotchkiss closed 7 years ago

kylehotchkiss commented 7 years ago
var social = function() {
    jQuery("a[href*='twitter.com/intent']").unbind();

    var socialpopup = function( url, title, width, height ) {
        var top = ( screen.height / 2 ) - ( height / 2 );
        var left = ( screen.width / 2 ) - ( width / 2 );

        window.open( url, title, 'toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=no, copyhistory=no, width=' + width + ', height=' + height + ', top=' + top + ', left=' + left );
    };

    jQuery("a[href*='facebook.com/sharer']").click(function( event ) {
        event.preventDefault();
        var url = jQuery(this).attr("href");
        socialpopup( url, "Share on Facebook", 550, 520 );
    });

    jQuery("a[href*='twitter.com/intent']").click(function( event ) {
        event.preventDefault();
        var url = jQuery(this).attr("href");
        socialpopup( url, "Share on Twitter", 550, 520 );
    });
};

I think this provides good UX because it opens Facebook and Twitter shares in the same sized popup. I've added this to a bunch of sites and haven't seen any errors with it. Works as expected on mobile. What do you guys think of dropping it into bubs?

ccorda commented 7 years ago

How does it play with quickshare which we have?

There is also the open social analytics ticket: https://github.com/patronage/bubs-wp/issues/15

kylehotchkiss commented 7 years ago

I've actually not seen quickshare in action, do you have an example handy?

On Fri, Dec 2, 2016 at 6:21 PM, Cameron Corda notifications@github.com wrote:

How does it play with quickshare which we have?

There is also the open social analytics ticket: #15 https://github.com/patronage/bubs-wp/issues/15

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/patronage/bubs-wp/issues/30#issuecomment-264589214, or mute the thread https://github.com/notifications/unsubscribe-auth/AAGmjAKvrIrJOqg-Qq7yQaxs9vdhy5Inks5rEKfhgaJpZM4LCsjl .

ccorda commented 7 years ago

https://github.com/Upstatement/quickshare

Sample from their docs:

<div class="qs-container" data-qs-url="http://specific-url.com">
    <a class="qs-link" data-qs-service="twitter">Twitter</a>
    <a class="qs-link" data-qs-service="facebook-share">Facebook</a>
</div>
ccorda commented 7 years ago

I think quickshare takes care of this sufficiently, closing out.