Dynamically show / hide Facebook as a button

Here is my problem:

I have successfully enabled the Facebook Like button on my test page. There are several elements on each page, and on the element there is a button resembling facebook. I am using the XFBML version.

Everything works fine if the buttons are present on the page when loading. However, now I want to show the buttons on an element only when I hover over a container element that has an element and a button. So the html of the fblike button is hidden when the page loads, and I added some code like this to show them on hover

    $(content).mouseenter(function(){
      $(this).find('.fblike').show(); // toggle the display of the button

      FB.XFBML.parse( this ); //re-parse xfbml
    });

The button now displays perfectly when you hover over the container, but never works. Pressing a button does nothing.

Has anyone encountered this problem before?

EDIT:

.fblike - div, fb: like.

, div .fblike . SDK JavaScript JavaScript xfbml .

+3
1

, . :

FB.XFBML.parse($(this));

( ), ( ).

0

Source: https://habr.com/ru/post/1761967/


All Articles