FB Like Help!
2014-10-30, 07:55 PM,
#1
Hello guys I want to hide some div id on my website when someone like my page.. but I tried many code and no one works.. is there something wrong with my code?

Please I need your help..
this is the code I'm using
Quote: <script>
FB.Event.subscribe('edge.create', function(response) {

document.getElementById('spu-title').style.visibility='hidden';
statement++;

});
}</script>

How much you can take and keep moving forward.
That's how winning is done!

Reply
2014-10-30, 08:55 PM,
(This post was last modified: 2014-10-30, 08:58 PM by BlackChico.)
#2
i'm not that expert in codings, i think you should set your display to block then set it to none if you want to hide it

this what i mean..
document.getElementById('spu-title').style.display='none';
you should set first the div style display to block then use the code above
hope it helps
Latest Thanks - View all

50cent(2014-11-04 10:48 AM) 
Reply
2014-11-04, 10:16 AM,
(This post was last modified: 2014-11-04, 10:17 AM by dvLden.)
#3
Code:
FB.Event.subscribe('edge.create', function( response ) {
    document.getElementById('spu-title').style.visibility = 'hidden';
});

Your snippet code contain some errors as I could notice. I removed them but still that bit of code won't do anything. Also what is statement++ increasing ? Because you did not mentioned that.

Either way, this will get you going pretty much.

- First of, here's a DEMO.

- Following code below is a must:

HTML

Code:
<div class="fb-like" data-href="http://your-website.com" data-layout="standard" data-action="like" data-show-faces="false" data-share="false"></div>

JS
Code:
var $body = document.body || document.getElementsByTagName('body')[0],
    $elem = document.getElementById('content-to-hide'),
    fbRoot = document.createElement('div');

fbRoot.id = 'fb-root';
$body.appendChild(fbRoot);

window.fbAsyncInit = function() {
    FB.init({
        appId: '533992156714965',
        xfbml: true,
        version: 'v2.1'
    });

    FB.Event.subscribe('edge.create', function() {
        $elem.style.display = 'none';
    });

    FB.Event.subscribe('edge.remove', function() {
        $elem.style.display = 'block';
    });
};

(function(d, s, id){
    var js, fjs = d.getElementsByTagName(s)[0];
    if (d.getElementById(id)) {return;}
    js = d.createElement(s); js.id = id;
    js.src = "//connect.facebook.net/en_US/sdk.js";
    fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));

So make sure you apply "APP-ID" which is required by facebook sdk.
Well with all that, I hope I helped you out and made things clear.
Latest Thanks - View all

dahilan01(2014-11-04 11:14 AM) 50cent(2014-11-04 10:48 AM) 
Reply


Possibly Related Threads...
Thread Author Replies Views Last Post
  [HELP] Extended FB permission for App neroazzurro 3 623 2015-04-06, 08:55 AM
Last Post: neroazzurro
  [HELP] “Invalid redirect_uri:" FB APP callmepeige 4 414 2014-05-03, 08:12 AM
Last Post: allworld




About Us | Contact Us | CPA Elites | Advertise | Stats | Staff Team

© 2013-2017 CPA Elites Ltd
Enhanced by MyBB and WallBB
Return to top