Fakt7
Fakt7

Reputation: 187

div class is active after page refresh

My homepage content is into

<div class="active">
         Homepage content
       </div> 

Class active is removed after some link (link1...link5) is clicked with jquery script

   $(document).ready(function(){ 
   $("#link-link1 , #link-link2 , #link-link3 , #link-link4 , #link-link5").click(function(){
   $(".active").css("display","none"); 
})})

It work but when i refresh page, class active (homepage content) is visible. I tried this code

HTML

<body onLoad="CheckPageLoad();">

    <input type="hidden" name="visit" id="visit" value="" />

</body>

javascript

function CheckPageLoad() {
    if (document.getElementById("visit").value == "") {

        document.getElementById("visit").value = "1";
    }
    else {
               $(".active").css("display","none"); 

    }
}​

It is not working. You can try it here (and see full code)

Upvotes: 2

Views: 867

Answers (1)

Nathan Foss
Nathan Foss

Reputation: 680

When I look at your site, I see a couple things right away. The console showed these 2 errors

GET http://skusobnastranka1.php5.sk/Unnamed%20Site%202/demo.css 404 (Not Found) skusobnastranka1.php5.sk/:12
GET http://skusobnastranka1.php5.sk/jquery.js 404 (Not Found) skusobnastranka1.php5.sk/:20

Since your jquery library isn't found, your jquery calls won't execute. Try again after you provide a proper link to a jquery library e.g. //ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js

Upvotes: 1

Related Questions