Hide div, display only in home

3

How do I hide / remove the slider and the banner below it with JavaScript? I need him to stay home only, but he's repeating in every department of the site .

    
asked by anonymous 01.07.2014 / 18:45

3 answers

2

This kind of client-side re-design (via JavaScript) is not a good solution. It's best to be able to change this from the server side.

Assuming this is not possible, then you have to find something that distinguishes the pages. I noticed that background only menu does not work, this could be a help if it were to work ...

So the idea I had was to look for that text that shows which page you are and do not have on the first page .

The text is Início > Camisas > Manga 7/8
A selector for it would be: $('a[title="Início"]')

The idea is to have this code that, in case there is no such information, hides the slider.

if (!$('a[title="Início"]')) $('.imgBaFu').remove();
    
08.07.2014 / 11:54
2

You can search for text in the URL that identifies that you changed pages by using the indexOf method in the < a document.URL .

// Se encontrar o texto "/Departamento?idExpandido=" na URL 
// (creio que seja o suficiente para identificar que não é mais a homepage)
if (document.URL.indexOf("/Departamento?idExpandido=") > -1) { 
    // esconde os botões
    $(".carousel-indicators").hide(); 
    // Mais comandos
    // ...
}
    
01.07.2014 / 19:02
0

Two solutions to make the banner disappear when you click the menu.

Solution number 1:

$('#cssmenu').click(function(){
    $('.imgBaFu').hide();
});

Solution number 2:

(function($){
    $.getUrlVar = function(key){
    var result = new RegExp(key + "=([^&]*)", "i").exec(window.location.search);
    return result && unescape(result[1]) || "";
    };
})(jQuery);

var r = $.getUrlVar("idExpandido");

r != "" ? $('.imgBaFu').hide() : 0;

Running this on ready will solve your problem, I already tested it with FireBug on your site.

    
03.07.2014 / 22:24