Allow the words to seamlessly transition back and forth between columns in a continuous cycle

Currently, I am attempting to showcase a large text in a format similar to a book. Each "page" has designated width and height, with content displayed over two columns: left and right. In this layout, page 1 is on the left, page 2 on the right, page 3 on the left again, and so forth, creating a continuous pattern of alternating pages throughout the webpage's height.

The basic structure of the code is as follows:

<div class="left">
<!-- Page 1 -->
<p>Text for page 1 here</p>

<!-- Page 3 -->

<br /><p style="text-indent: 0px;"> Text for page 3 (below page 1) here.</p>

</div>

<div class="right">
<!-- Page 2 -->
<p>Text for page 2 displayed next to page 1 with a few pixels margin using float: right styling. </p>

<!-- Page 4 -->
<br />

<p style="text-indent: 0px;">Text for page 4 goes here. Displayed beside page 3. </p>
</div>

The accompanying CSS ensures that the two columns are aligned adjacent to each other (#right and #left). The concept revolves around matching the text to display on the appropriate side during each page break.

CSS code:

.left{
  font-size: 20px;
  float: left;
  margin-left: 20px;
  width: 500px;
  margin-right: 20px;
  text-align: justify;
  /*height: 680px;*/
  margin-bottom: 20px;
}

.right{
  font-size: 20px;
  margin-left: 10px;
  float: right;
  text-align: justify;
  height: 680px;
  width: 500px;
  margin-bottom: 20px;
}

The challenge I currently face involves automatizing this process to facilitate use of a WYSIWYG text form within Wordpress and implementing a fixed height for the two columns. I desire the text to initiate from the left column and automatically shift to the right once reaching the page's height limit, only then reverting back to the left column upon reaching the right column's height limit (both set to the same height). This alternating pattern should continue seamlessly for all text sections.

My main hurdle lies in my lack of knowledge in JavaScript. While I discovered this solution, it does not specify how to transition the text from the right to the left column after surpassing the right-side limit.

I hope I have conveyed my issue clearly. If any part remains confusing, please feel free to bring it to my attention. Despite dedicating the entire summer to this project, I still struggle to find a viable solution. Thank you in advance for any assistance!

Answer №1

One way to achieve this is by utilizing the CSS3 columns feature, although it may not work effectively across all browsers.

Alternatively, you could consider incorporating a jQuery plugin like

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

The Bootstrap 3.3 Carousel is stationary and does not rotate

I am facing a challenge with implementing a Carousel using Bootstrap version 3.3.7 on my website. The code snippet is as follows: <!-- Carousel ================================================== --> <div class="row dark-start d-none d-lg-block"&g ...

Having issues with AngularJS where ng-table/ng-repeat rows are failing to load properly

I've been following a tutorial on using ng-Table, which can be found Here. When I download the example from Git, it loads without any issues. However, when I try to replicate even the simplest example myself, the column headers and filters load but th ...

What is the reason behind installing both Typescript and Javascript in Next.js?

After executing the command npx create-next-app --typescript --example with-tailwindcss my_project, my project ends up having this appearance: https://i.stack.imgur.com/yXEFK.png Is there a way to set up Next.js with Typescript and Tailwind CSS without i ...

uncovering the secrets of tree shaking when using an npm package in conjunction with webpack

Imagine having an npm package where all components are exported from a single index.js file: export * from './components/A'; export * from './components/B'; Now consider another package that relies on this initial package: import {A} ...

JavaScript substring() function in clone is experiencing an error

I am currently working on a JavaScript function that determines whether a specific substring is present in a larger main string. For instance, if the main string is "111010" and the substring is "011," the expected result should be false since the substr ...

Employing res.sendStatus(200) in conjunction with JQuery AJAX

I've implemented a form that triggers an AJAX call to my backend, utilizing Node and Express. The onsubmit function is responsible for this interaction. Once the submission is successful, I use res.sendStatus(200) to inform the client. This results i ...

The CSS styles can vary depending on the web browser being used

Require assistance with my CSS. I designed an HTML/CSS widget on Blogger using my own expertise, but now facing some issues. The trouble arises with the image on the front left in the code. While it displays correctly on Google Chrome, aligned with the te ...

Error Detected: the C# script is not compatible with Javascript and is causing

I am facing an issue where I can successfully send information from the database, but I am unable to load the table on the page. When I check the data received with an alert, it appears to be in JSON format, but it still displays the wrong image on the web ...

What is the best way to combine jQuery objects in order to apply CSS styles collectively?

If I have a custom function that takes in multiple jQuery objects: customFunction($('.content'), $('h1'), $('input[type=button]')); The function is defined as follows: function customFunc ...

How can I trigger a PHP function from within an HTML onClick() event?

While I have come across a response on stackoverflow regarding form submission, my query pertains to a different implementation. I am in need of calling a function that registers a variable in $_SESSION[], and then redirects to another page (html/php). I ...

In Node.js, the module.exports function does not return anything

After creating a custom function called module.exports, const mongoose = require("mongoose"); const Loan = require("../models/loan_model"); function unpaidList() { Loan.aggregate([ { $group: { _id: "$ePaidunpaid", data: { $pus ...

Maintain an equal distance between 2 out of 3 elements while resizing the window to ensure responsiveness

There are two image divs stacked on top of each other, positioned beside a fluid header logo (.svg) also contained in a div. The HTML: <header class="site-header" role="banner" itemscope="itemscope" itemtype="http://schema.org/WPHeader"><div cla ...

JavaScript JSON conversion from a list

If I have two different lists, such as: list1= ['blue', 'green', 'purple'] list2 = ['circle', 'square', 'triangle'] Is there a way to convert them into a JSON object structure by using another l ...

Is there a way to eliminate the blue border from a Material React Modal?

I am currently using the React Material Modal and noticed that in the demo examples, there is a blue border when the modal is opened. Is there a way to remove this blue border? I have tried setting the disableAutoFocus property to "true" in the Modal Api ...

Fetching JSON data cross-domain with the help of JavaScript or JQuery

I am currently attempting to retrieve JSON data from this specific url. However, I am encountering difficulties in making it function as intended. The goal is to seamlessly integrate the school's lunch menu utilizing NutriSlice. We are leveraging Ris ...

Element with absolute position does not expand along with scrollable content (over 100%)

In my popup window, the fade element is supposed to stretch to the full width of the screen. However, when the content exceeds 100% of the browser window height, the element does not extend to the full page height. If I set html, body { height: 100%; over ...

Wrapping HTML input elements in a div for alignment

I need help aligning the inputs in my form to match the image provided . I attempted to center the div using <center>, but I am unsure how to properly align the elements based on the image reference. <center> <div> <div& ...

PHP code $this->item->link within an anchor tag is not functioning properly and is displaying JObject->link instead

Hey, can you help with this quick question? It's driving me crazy! I have a PHP file where I'm pulling in different items like contact details. One of these items is $this->item->link, which displays a perfect URL. All I want to do is make this ...

When an element possesses a particular class, modify the css styling of a different

My menu is an unordered list, with each menu item gaining the "active" class when clicked. This works perfectly fine. However, I have an arrow positioned absolutely and its "top" style needs to change based on which list item has the "active" class. Curr ...

Select the hidden HTML option value automatically according to the previous option selected

I am working on a form that includes 2 select tags with the options male and female. The first select, "gender", is visible to the user while the second select, "age", is hidden. <select name="gender"> <option value="1">Male</option> ...