0
Help me to add this..
Image should get fullscreen when clicked and back to normal when click again. I want to add this. How can i? https://code.sololearn.com/WuA39xPK4STr/?ref=app
7 Answers
+ 1
I saw your code... And I found a better way to do that. You only need one element that have an ID and two classes, the first class have the small format and the second class have the expand formad, so you just need to toggle the second class because this overwrite the first class, in js search you element by the ID and toggle the second class, just the second class.
Like this:
<div class="firstClass" id="element"></div>
.firstClass{
width:50%;
}
.secondClass{
width:100%;
}
$("#element").click(function(){
this.toggleClass("secondClass");
});
+ 1
Because you need to add the code for each element, changing the id
$("#id").click(function(){
this.toggleClass("secondClass");
});
Or add the name atribute in each one and change the script
<div class="firstClass" name="element"></div>
$('td[name="element"]').click(function(){
this.toggleClass("secondClass");
});
+ 1
I am not using id. I changed id into class. You can check my code.
+ 1
Great, you understand how it works
0
Thank you so much. It worked. But next image is not working why?
0
Yes i got it. Thank you bro.
0
Yes thank you so much