huacnlee / social-share-button

Helper for add social share feature in your Rails app. Twitter, Facebook, Weibo, Douban ...
MIT License
582 stars 309 forks source link

Social-Share-Button visible but redirecting to same page #179

Closed Shaheen-Al-Asadi closed 5 years ago

Shaheen-Al-Asadi commented 5 years ago

Im trying to add share buttons to a blog page, ive included the js/css portions and in my view i have:

<%= social_share_button_tag(@blog_post.title,
                                        :url => "mysite.com/blog/",
                                        :image => "https://www.mediawiki.org/wiki/Help:Images#/media/File:Example.jpg",
                                        desc: @blog_post.title,
                                        via: "twitterhandle")
%>

Now when clicking any of the buttons it redirects to the top of the page: "http://localhost:3000/blog/some-title" turns into "http://localhost:3000/blog/some-title#"

What am i missing? Is it because I'm testing on a local server?

huacnlee commented 5 years ago

Open your Chrome Developer Tool, there must be have some JavaScript error.

Shaheen-Al-Asadi commented 5 years ago

Edit:

Nevermind it is working now :) Our project used a different javascript partial file instead of the standard app/assets/javascripts/application location, i placed "//= require social-share-button" in the correct file and it is working. Thank you for this gem ⭐️