6
I’d like some help for a problem I’m having:
I’m doing something similar to a gallery, and when the user clicks on the image it has to open in large size, not the entire screen, but covering much of the page. Also, I need her to become.
I’ve tried that code here:
$(document).ready(function(){
$('#img-responsive').on( "click", function() {
$('#cool').toggleClass('maxSize')
});
});
.maxSize {
height: 70%;
width: 70%; }
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.0.0/jquery.min.js"></script>
<br><img class="img-responsive" src="img/teste.png">
But it didn’t work. I tried some variations of the above code, but I still didn’t succeed. Thanks in advance
Do you want to open the image inside a "dialog"? or do you want it to grow where it is?
– Sergio
No friend, no dialog. According to the material design it should grow from where it is.
– MucaP
You made $('#cool'). toggleClass('maxSize')... but the image has the cool ID
– PauloHDSousa
You have to use
class
and not ID. Test like this:$('.img-responsive')
, take a look here: https://jsfiddle.net/hw2jw753/ and explain better what you cannot do yet.– Sergio
Use . Animate() and make it more handsome!!!!
– RBoschini