Add CSS by clicking a button that goes to another page

Asked

Viewed 591 times

1

I need to add height in a div when I click a button, only there is one but this div is on another page and that’s where I’m not able to do it, I’ll show you how I did in the code below if anyone can help

CODE

$('.close-reveal-modal').click(function(){
    $('#site .makingof .slide').addClass('insere-altura');
});​

Explaining the code: When I click . close-Reveal-modal it goes back to the index.php page and inserts the "height inserts" class along with the slide class.

1 answer

1

It is a little complicated to achieve this behavior only with javascript

a solution would be to use localStorage:

  • Record some kind of information in localstorage and on the index page check the localstorage if the information is present add the class. Ex:

// No Index
$(function(){
  if(localStorage.getItem('close-reveal-modal-clicked')){
       $('#site .makingof .slide').addClass('insere-altura');
  }
});


$('.close-reveal-modal').click(function(){
  localStorage.setItem('close-reveal-modal-clicked', true);
});​

  • didn’t work out, what happens is that I have on the main page a vertical carousel with a lot of Thumb, when you click on a Thumb of these goes to the internal page, when one clicks on the back button, He didn’t come back in the same row as Humbs so I made an anchor and each li has 6 Humbs and I called id="box'" for ex, when I implemented it worked he went back to the row but stuck at the top of the page. What’s missing now is not staying at the top of the page, what I’m not getting

  • Put an example there or send a screen print of how it is and how it was to look, to better understand how it would be

  • this link is the image of how it should look when it returns from the other page http://progdesenv.com.br/img/comoepraficar.jpg this link is as it is currently when I return from the other page http://progdesenv.com.br/img/comoesta.jpg Note that the Thumbs are still in the same position, the problem is that the menu is fixed and when I set to return as anchor it goes to the top of the element thus getting behind the menu

  • and if the user disables the local storage how does it look? hah...

Browser other questions tagged

You are not signed in. Login or sign up in order to post.