mercredi 27 mai 2015

How to use jQuery to change css div visibility on checkbox input?

I'm trying to change the visibility of a div based on a jQuery .click of a checkbox input.

I've been working on fixing an issue with a Full Screen CSS Nav. This is the modified CodePen: http://ift.tt/1QbBO4U

Visibility Toggle:

$.fn.toggleVisibility= function() {
var $this  = $(this);
if($this.css("visibility")=="hidden"){
    $this.css("visibility","visible")
}else{
    $this.css("visibility","hidden")
}
return this;
};

Checkbox Click to Initiate the Function:

$(".checkbox-toggle").click(function (){
   $("#links").toggleVisibility();
})

Relevant HTML Lines: 3 & 7
Relevant CSS Lines: 123

NOTE: This is currently not working. The div remains hidden




Aucun commentaire:

Enregistrer un commentaire