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

Error message: ParseError: Received an unexpected character '<' while running tests using AVA

Initially encountering an issue within the project built on nuxt, I attempted to resolve it by creating a new project using vue-cli and re-installing AVA via npm. However, this did not have any effect on the problem at hand. Upon researching, I came across ...

The synchronization between jQuery's onLoad and onDomready functions allows for seamless

When utilizing jsFiddle, I have noticed two options for initializing content using jQuery: onLoad or onDomReady. I have tested most of the scripts I've written and found no noticeable functional difference. Upon researching via Google, I discovered o ...

Is it possible to use a server action in Next.js to both retrieve data and refresh the page?

I am currently working on developing a web application using Next.js (13.4.9) and I intend to utilize server actions. These server actions will involve sending data to the server, which will process the data and return a string back to me. The challenge I& ...

Monitor the traffic on my website by implementing .htaccess restrictions

I am maintaining a website with restricted access to specific IP addresses listed in the .htaccess file. I am looking to implement a logging system that tracks unauthorized attempts to access the site. Is it feasible to record each attempt in a database? ...

Unable to properly export the HTTP server for socket.io communication

I am facing an issue with my app.js const express = require('express'); const app = express(); const server = require('./server.js'); // app.use const io = require('socket.io').listen(server); io.on('connection', f ...

Overlay one image on top of another

Recently, I've been working on this code snippet. I am attempting to center the profile picture even when the screen width is reduced. The issue lies with using position:absolute, preventing margins:auto from functioning properly. As a workaround, I ...

Issues with jQuery Ajax

Hello all, I've come across this snippet of jquery code: <script type="text/javascript" > $(function() { $(".submitButton").click(function() { var post = $("#post").val(); var dataString = 'post='+ ...

Transparent static navbar displayed above header image

Scenario I managed to develop a transparent navbar that is superimposed on top of a header image with an SVG curve attached to it. To create the transparent navbar, I modified some classes associated with it by removing bg-light. By adding the class fix ...

Is it possible to manually trigger a version change transaction in IndexedDB?

I have been working on a Chrome extension that uses the IndexedDB to store data client-side in an IDBObjectStore within an IDBDatabase. The data structure requires users to be able to modify the object store freely, such as adding new objects or modifying ...

Completely shrink the middle row first when resizing the browser before shrinking the other rows

Utilizing a simple three row structure: <div class="EditorHeaderWrapper"> <h1>Title</h1> </div> <div class="EditorMainRowWrapper"> // Content of the main row goes here </div> <div class="EditorFooterWrapper"> ...

Dynamic value changes in AngularJS checkboxes controlled by ng-model within controller

I have a page that loads data from a database and displays it in a grid. It has a button to manually refresh the data, as well as a checkbox for automatic refreshing. Below is the HTML code: <div id="TestViewTable" ng-controller="testTableManager" ng- ...

Discovering the power of Next.js Dynamic Import for handling multiple exportsI hope this

When it comes to dynamic imports, Next.js suggests using the following syntax: const DynamicComponent = dynamic(() => import('../components/hello')) However, I prefer to import all exports from a file like this: import * as SectionComponents ...

Angular Reactive Forms may not properly update other inputs when binding a control to multiple inputs

While working with reactive forms, I encountered an issue where accessing the same control in multiple inputs seemed to result in one-way data binding (input-to-model). If I make edits in one input, it updates the model correctly but does not refresh the o ...

Executing scripts within various node project directories using npm

Creating Concurrent NPM Scripts In my main project, I have several node projects nested as subdirectories. Each of these projects has its own node_modules directories and package.json files. My goal is to define an npm script in the main project's pa ...

Using Firefox to cache Ajax calls after navigating back in the browsing history

Currently, I am utilizing an ajax call to invoke a php script that waits for 40 seconds using sleep and then generates the output RELOAD. Subsequently, in JavaScript, the generated output is validated to be RELOAD, following which the call commences again. ...

Click here to view the latest Poll Results!

I have implemented AJAX to display poll results on the same page without requiring a refresh. An issue I am facing is that the poll section occupies about three times more space than the results. This causes an inconvenience for users who vote, as they ma ...

Unusual Type Inference in Typescript {} when Evaluating Null or Undefined

Upon upgrading from typescript 4.9.3 to 5.0.2, we encountered an error when asserting types. Can someone explain why the function "wontWorking" is not functioning correctly? I expected this function to infer v as Record<string, any>, but instead it ...

What are some effective ways to manage errors in Ajax deferred calls?

What is the best way to handle an Ajax deferred error? function CallingApi() { return $.ajax({ url: 'http://localhost:10948/Api/Home/GetEmployee123', contentType: 'application/x-www-form-urlencoded', ...

Why does json_encode() work for one string and fail for another?

UPDATE: Resolved the issue. Initially, someone left a comment with a solution that was later deleted. Interestingly, simply adding semi-colons after the two json_encode lines fixed the problem. I'm still puzzled as to why string1 worked without a clo ...

React.js pagination - removing empty values from an array

I'm currently working on implementing pagination logic that automatically updates the page numbers when the last index is clicked. For example: 1 2 3 4 5 If a user clicks on the number 5, it should display: 2 3 4 5 6 and so forth... I have succe ...