Giter Site home page Giter Site logo

Comments (9)

pmb0 avatar pmb0 commented on September 27, 2024

Let me see if I understood your question. You replaced the old socialshare-privacy code with Shariff.

The socialshare-privacy documentation recommended using the script tag inside the <head> of your document.

In contrast to that, Shariff must be included right before the (closing) </body> tag to work. Have you followed that instruction?

from shariff.

neffets avatar neffets commented on September 27, 2024

Yes,
if I would have an <div class="shariff"></div> it would work that way.
My problem is,

  1. that the html-code has no class="shariff", i have an id=socialshare
  2. I want enable the Share-Buttons later, not at body-end, but only after dom-ready

Solution could be:

  1. on dom-ready I add with javascript the class=shariff to my div-with-id
    Now comes problem 2
  2. dom-ready ist later then body-end, I now want to trigger the shariff-code later, or better I want to give my $('#socialshare') as object to Shariff to paint the share-buttons there

from shariff.

pmb0 avatar pmb0 commented on September 27, 2024

Embedding Shariff is difficult in your situation (not a node project, no .shariff element).

Try something like this:

<head>
$(function() {
    $("#socialshare").addClass("shariff");
    $.getScript("/path/to/shariff.js");
});
</head>

In my opinion modifying the HTML document is the best option.

from shariff.

leegladding avatar leegladding commented on September 27, 2024

We had a problem using this too recently. Our project was also not a node project.

We had need to initialize the shariff code after it was loaded on to the page, to allow for later ajax'd content to include the sharing functionality. The way we fixed this was to assign the _Shariff function to the window object. This allowed us to call as and when we needed.

Is this something you could add to this project to allow the plugin to be used in this way as well?

from shariff.

pmb0 avatar pmb0 commented on September 27, 2024

Just pushed a change that renames _Shariff to Shariff and that exports the Shariff class to the global (window) object:

27cd300#diff-f9e06b21d8f4ff0e3fd8301ee954ec47R236

This example html page shows how to initialize shariff after it was loaded:

https://github.com/heiseonline/shariff/blob/master/demo/custom-initialization.html

The change is not released yet.

from shariff.

leegladding avatar leegladding commented on September 27, 2024

Looks great. Any idea when this might be released?

from shariff.

pmb0 avatar pmb0 commented on September 27, 2024

Today or tomorrow.

from shariff.

leegladding avatar leegladding commented on September 27, 2024

Perfect. Thanks for the update.

from shariff.

pmb0 avatar pmb0 commented on September 27, 2024

Just released v1.9.1.

from shariff.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.