Animation of scrolling in a horizontal layout

Currently, I am utilizing ng-repeat 1.4 to dynamically generate elements within a div that has polymer shadow classes and uses the 'layout horizontal' style, resulting in code similar to:

<div class='layout horizontal'>
     <div ng-repeat="elements in forms"></div>
</div>

Although new elements are rendered smoothly at the right side of the previous one with focus, there is an abrupt appearance which makes scrollbars appear suddenly without any transition, causing a slightly chaotic visual effect. I would like to implement a smooth scrollbar movement.

I have included a sketch depicting the current situation: https://i.stack.imgur.com/pM9jD.png

To address this issue, my thoughts are:

  1. Avoid sudden movement to the new element.
  2. Gradually move the scrollbar from its previous position to the new one.

Are you aware of any transitions in Angular or Polymer that could accomplish this? Any ideas on how to achieve this desired effect?

Answer №1

While I may not be familiar with angular and ng-repeat, it seems that the logical approach would be to handle it in a more traditional manner;

.horizontal
{
   width: 100%; /* or whatever width you prefer */
   overflow-x: scroll;
}

 /* clear floats for inner elements */
.horizontal:before{ clear: both; content: " " }
.horizontal:after{ clear: both; content: " " }

.horizontal .elements.in
{
   float: left; /* align horizontally */
   width: 500px; /* or your preferred inside elements width */
}

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

Retrieving HTML source code using PyGTK WebKit

Can anyone help me with this issue I am facing in my code? When I try to get the HTML source code of the current page, all I get is 'GString at 0x8875130'. How can I convert this into actual text that contains HTML? import gi gi.require_version( ...

Jquery Toggle not applying class change on mobile devices

Check out my website: . There's a menu option called Services with a dropdown feature. Here is the code for it: <li class="dropdown menu-services"><a class="dropdown-toggle" href="#" data-toggle="dropdown" data-target="#">Services <b c ...

What is the process for running an Angular 1.4 application on a system with Angular 6 installed?

After installing Angular 6 with CLI, I realized that my project was written in Angular 1.4. How do I go about running it? ...

When I click on .toggle-menu, I want the data-target to have a toggled class and the other divs to expand

Looking to achieve a functionality where clicking on .toggle-menu will toggle a class on the specified data-target element and expand other divs accordingly. jQuery(document).ready(function() { var windowWidth = jQuery(window).width(); if (win ...

Utilizing Regular Expressions in AngularJS to validate name, a 10-digit mobile number, and a 12-digit number through the ng-blur event and match

I am struggling to validate the three inputs mentioned above and having trouble using the right functions. Can someone please assist me with this? Here is the HTML code for the 3 inputs: <input id="name" ng-model="user.name" ng-blur="checkIfNameIsVali ...

Custom Select Menu Options from Basic Key-Value Mapping

There are other answers that discuss using ng-option with an object structure like this: $scope.opts = [ {value: 111, text: '1st' }, {value: 222, text: '2nd' } ]; However, I am curious if it is possible to achieve the same functi ...

Exploring the concept of closures in AngularJS

In the realm of angularjs FAQ, there exists the inquiry: Is it viable to utilize the open-source Closure Library alongside Angular? Absolutely, widgets from the Closure Library can be integrated with Angular. Despite this affirmation, specific examples s ...

Using the float property in IE7 can cause a line break and may result in other divs being pushed down

Hey there, I've encountered a few issues with floats in IE multiple times. Here's an example to illustrate what I mean. Please note that this example functions properly in Firefox and Chrome. index.html <html> <link href="style.css" rel= ...

Having trouble applying styles to a component using forwardRef

I'm relatively new to React and still trying to wrap my head around the component's lifecycle. However, the issue at hand is proving to be quite perplexing. One thing that confuses me is why adding "setState(10);" causes the style of the "Test" ...

Eliminate the dimming background on a discussion thread in Discourse

Working on customizing a theme for my blog using the Discourse engine has been quite interesting. I have noticed that every post, or "topic," loads with a blue background that quickly transitions to the main background color. You can take a look at an exam ...

When the credentials flag is set to true, the use of a wildcard '*' in the 'Access-Control-Allow-Origin' header is not allowed, as per Stormpath's guidelines

Currently, I am integrating Stormpath into my project and I want to keep the API separate from the client code (Angular, utilizing Stormpath's angular-sdk). This means that the API will be hosted on a different sub-domain compared to the client. Howev ...

What is the most efficient way to implement OR conditions in JavaScript for shorter code

Hello there! I have a question about optimizing conditions in code. Is there a more elegant way to write the following conditions? state === 'su' || state === 'ja' || state === 'fa' I was thinking if it could be simplified ...

Navigating through website links while working locally on a localhost server can

After exclusively working on live domains or subdomains in the past, I recently experienced the benefits of working on localhost. Utilizing a Wamp server on my Windows machine, I store my project in C:/wamp64/www/[project_name]. I have always used relativ ...

Unlocking the Mysterious Realm of HTML

I recently stumbled upon a mysterious combination of HTML attributes: <div vanisheffect="true" blinkcolor="red" fadeopacity="0.8"> Have you ever encountered something like this? And more importantly, does it have any impact on specific browsers? Is ...

Updating the image source attribute using Vue.js with TypeScript

Let's discuss an issue with the img tag: <img @error="replaceByDefaultImage" :src="urls.photos_base_url_small.jpg'"/> The replaceByDefaultImage function is defined as follows: replaceByDefaultImage(e: HTMLImageElement) ...

Animate the entrance of mobile content as it slides into view while scrolling

I am currently working on a WordPress theme and facing an issue: When I click the hamburger menu without scrolling down the page, the mobile menu slides in smoothly. However, if I scroll down the page, the mobile menu fails to slide into view (I have to s ...

Tips for wrapping text around an image using Bootstrap 5

I am having trouble getting my text to wrap around an image using the Bootstrap 5 grid system. I've attempted to use 'float: right' on the image, but it hasn't produced the desired result. The text should flow naturally around the imag ...

Retrieving $rootScope within a callback function in Google Maps

I'm running into issues when trying to access the $rootscope of my Angular application from within a 'load' callback for the Google Maps API. Here is a snippet of my index.html: <html> <body ng-app="myApp"> .... <script>a ...

Enhance the brightness and add a subtle glow to an image inside a div element when hovering over the div

Is there a way to create an effect where the image within a div brightens when hovering over the entire div without affecting any other elements? Here is my code, any suggestions or improvements are appreciated. #textimg{ background-image: url( ...

I wish to substitute a form field with a different one once the value of another field matches a specific condition

The issue I'm facing is that the field disappears once "US" is chosen and does not revert back to the options when another choice is made. teacher_signup.html {% block content %} <h2>Sign Up As Teacher</h2> <form method="post> ...