Home > DeveloperSection > Forums > Jquery elements always block
Monaj Singh
Monaj Singh

Total Post:41

Points:287
Posted on    October-30-2014 11:51 PM

 JQuery JavaScript  HTML  Facebook API  CSS 
Ratings:


 1 Reply(s)
 748  View(s)
Rate this:
Hi Guys

I have created Safari Extension that blocks certain elements from Facebook and I was wondering is it possible to make it block all the time. For example, it blocks the elements when you load Facebook, however when you click the Facebook logo in the top left corner all the elements come back, you have to manually reload the page to block them again. So basically all the elements come back when you click something that doesn't reload the page.Please help me

Here is my code.

jQuery(document).ready(function () {

      $("#content").find("#sideNav").find("#listsNav").css("display", "none");

});



Hugh Jackman
Hugh Jackman

Total Post:52

Points:366
Posted on    October-30-2014 11:55 PM

It all depends on what facebook actually does when you click the logo.

If it makes an AJAX request, then you can listen for that event and re-hide the elements then.

For example:

$(document).ajaxComplete(function () {

    $("#content").find("#sideNav").find("#listsNav").css("display", "none");

});

If it just runs some local javascript then you could listen for the click event, and again run your code. For example, assuming the logo has an id of #logo

$("#logo").click(function () {

    $("#content").find("#sideNav").find("#listsNav").css("display", "none");

});

In addition, as suggested by Satpal, ids are meant to be unique to a page so you don't need to find them the hard way, just reference them directly like so:

$("#listsNav").hide();


Don't want to miss updates? Please click the below button!

Follow MindStick