Back to previous page

Asked

Viewed 148 times

2

https://www.jqueryscript.net/demo/Smooth-Single-Page-Transition-Effects-Using-jQuery-CSS3-page-js/

I want to make 1 site like this, one page only but divide it into two parts, right and left. The site’s structure will be found in these two Ivs being the first this:

  <div class="page" data-jquery-page-name="11">
         <div class="title">Page 11</div>
              <div class="navigate" data-page-name="12" data-page-trans="slide-in-from-right">slide-in-from-right</div>
  </div>

and the second will be this:

<div class="page" data-jquery-page-name="12">
                        <div class="title">Page 12</div>
                        <div class="navigate" data-page-name="11" data-page-trans="slide-in-from-left">slide-in-from-left</div>
                    </div>

my question and how can I redirect to the second div, being that if I do header('Location:index.php'); I will automatically be redirected to the first div (data-jquery-page-name="11") and what I really want is redirected to the second div (data-jquery-page-name="12)

  • Do you already have the HTML/CSS/JS structure? The page you cite in the question is a plugin. Already downloaded it and tried to implement?

  • yes, I have the whole site already assembled. My problem is when I send 1 form that always goes back to the first div. https://spil.development.pt

  • It would be the contact form?

  • yes, can test, the link I sent to better understand the problem!

1 answer

1


By submitting the form, you are redirecting to index.php?sucesso=1. You can use the parameter ?sucesso=1 to open the second div directly instead of the first.

Since you are using a plugin, it only activates the first div when the page is loaded, so the only way I see to enable the second div is via Javascript. Then you will have to put a script in index.php that will activate the second div when the page is loaded and if the value of sucesso for 1.

Place at the end of body the following code:

<?php
if($_GET['sucesso'] == "1"){
?>
<script>
$(function(){

   $(".page.jquery-page-active")
   .toggleClass("jquery-page-active jquery-page-disabled");

   $("[data-jquery-page-name='12']")
   .toggleClass("jquery-page-disabled jquery-page-active");

});
</script>
<?php
}
?>
  • thanks, already working but still I am not able to anchor for when the form is sent, is in the second div and fixed in the contact form for example https://spil.development.pt/#contacts

  • I don’t know what you mean.

  • let me see if I can explain further, for example by sending a contact form, and once the form is sent I would like you to stay on this part of the page https://imgur.com/a/k58oCXQ

  • I understand now, but in the question you say you want me to stay in the div data-jquery-page-name='12'!

  • I already managed to solve, I sent the form with ajax, and resolved, because so it does not need page filling to send, but you helped me a lot

Browser other questions tagged

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