social-share-kit icon indicating copy to clipboard operation
social-share-kit copied to clipboard

Share Buttons Not Working Within Modal

Open runewolf7 opened this issue 8 years ago • 3 comments

Demo Environment

url: http://staging.ilnetwork.flywheelsites.com/voices-project/ryan-hampton/ user: flywheel pass: creativefuse

Action

Click the purple share button near the top

Expected Behavior

  1. A lightbox opens on the page. I am using Lightcase.js for this purpose.

  2. When I click any of the share buttons inside the modal, I expect the share functionality to run as intended and open in a new window with content populated.

  3. I am loading in the JS library for Social Share Kit via a JS bundle in the footer and initializing it in this way:

SocialShareKit.init({ selector: '.c-share__group .c-share__icon', });

Experienced Behavior

  1. When I click any of the share buttons, the lightbox is closing and the current page is simply reloaded. No sharing functionality fires. Additionally, no console errors are logged.

  2. Testing the Social Share Kit buttons outside of the lightbox properly trigger the share functionality.

  3. I attempted implementing a wait after page load, and also tried to fire off SocialShareKit.init() after the lightbox content finishes loading. It appears that everything is properly initialized and running as it should, right up until a share button is clicked.

runewolf7 avatar Feb 09 '18 15:02 runewolf7

I am experiencing the same issue. Have you found a solution?

robsilva avatar May 09 '18 02:05 robsilva

I figured it out. You need to initialize it when the elements are visible.

$('.modal').on('shown.bs.modal', function (e) {
          // do your init here
});

robsilva avatar May 09 '18 02:05 robsilva

@robsilva Yep! That's exactly what I ended up doing...sorry for not posting the solution here!

runewolf7 avatar May 09 '18 12:05 runewolf7