Angular package that includes horizontal scrolling functionality with arrow buttons

Currently seeking an Angular 2-6 package featuring a horizontal image scroll with arrows, similar to the functionality on Airbnb: https://i.sstatic.net/BOWzD.jpg

Any suggestions or recommendations are greatly appreciated – thank you!

Answer №1

This solution provides a custom horizontal scroll feature

In the .html file:

 <div class="pull-left mt-sm">
                      <i class="icon-arrow-left pointer" (click)="scrollLeft()"></i>
                </div>   

 <div #widgetsContent class="custom-slider-main">
        <div class="info-box">
             <img src="file.jpg" class="info-box">
          </div>
          <div class="info-box">
             <img src="file.jpg" class="info-box">
          </div>
          <div class="info-box">
             <img src="file.jpg" class="info-box">
          </div>
          <div class="info-box">
             <img src="file.jpg" class="info-box">
          </div>
          <div class="info-box">
             <img src="file.jpg" class="info-box">
          </div>
          <div class="info-box">
             <img src="file.jpg" class="info-box">
          </div>
    </div>

<div class="pull-right mt-sm">
    <i class="icon-arrow-right pointer" (click)="scrollRight()"></i>
    </div>

In the .scss file:

.custom-slider-main{
    display: flex;
    overflow: hidden;    
    scroll-behavior: smooth;
}

 .info-box{
    width: 50px;
    height:50px
 }

In the .ts file:

@ViewChild('widgetsContent') widgetsContent: ElementRef;

Use the following functions when clicking on the left/right buttons:

scrollLeft(){
    this.widgetsContent.nativeElement.scrollLeft -= 150;
  }

  scrollRight(){
    this.widgetsContent.nativeElement.scrollLeft += 150;
  }

Answer №2

If you're looking to create an image slider, there are a few options available to you. You could utilize an npm package, or take the time to learn how to build your own from scratch. A quick search for "angular Carousel" on Google will yield numerous results, including popular packages such as bootstrap and ngx-bootstrap that come with built-in slider functionality.

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

Tips for concealing error messages in Angular 7 when an input field is in focus

Is there a way to hide the custom validation message div when the input field is in focus? I'm looking for a solution to this issue. <div class="form-group"> <label class="col-sm-4 control-label">Password</label> <div class ...

Add a touch of vibrancy to the button background by incorporating two

Looking to apply two different background colors to my button. Here is the design I'm aiming for: Is it feasible to achieve this design using only CSS, or do you have any other suggestions? Appreciate your input! ...

Discovering a public holiday on the jalali calendar can be done by checking online

Looking to retrieve a public day in the Jalali calendar using npm Jalali-moment with the following code: var moment = require('jalali-moment'); moment().locale('fa').format('YYYY/M/D'); I found a website that has achieved thi ...

Toggling multiple ions simultaneously does not function independently

I encountered a problem while working on an ionic app. I needed to have individual control over toggle switches, but my current code toggles all switches at once whenever one switch is tapped. Is there a way to fix this and manage each toggle switch separa ...

Encountering HttpErrorResponse when sending a Delete request in Angular

I need help troubleshooting an issue with sending a Delete request from my movie.component.ts file to delete a review. Unfortunately, I keep receiving the dreaded HttpErrorResponse error. Can anyone pinpoint where I may be making a mistake? Take a look at ...

The scrolling action triggered by el.scrollIntoViewIfNeeded() goes way past the top boundary

el.scrollIntoViewIfNeeded() function is used to scroll to element el if it's not within the visible browser area. Although it generally works well, I have encountered some issues when trying to use it with a fixed header. I have provided an example s ...

Replace Angular Material Component with a new custom component in Angular

In order to customize the Angular Material select component (https://material.angular.io/components/select/overview) to have an input field transformed into an icon button, I attempted to override its styling. While this approach worked well for me, I came ...

Issue with series of node commands getting stuck on npx command

I have a custom node script that I use to automate the setup of my application. This script creates directories, generates files, and executes a series of node commands. Everything functions correctly for the most part. The specific commands being executed ...

Troubles arise with npm start and Installing Packages: Alert regarding babel-preset-react-app Dependency and Stuck Audit Fix in VSCode

Every time I execute npm start, I encounter the following message: When running npm start, I receive a warning about one of the dependencies, babel-preset-react-app, importing the "@babel/plugin-proposal-private-property-in-object" package withou ...

Angular 7 application encountering error 500 with URL Rewrite Module on IIS7 server

I am facing an issue with my Angular 7 application hosted on IIS 7. The app should be accessible at https://example.com/fitcbooks/web. It was working fine initially, but suddenly stopped without any clear reason. Despite the fact that URL Rewrite on the se ...

Enhance your visual content by incorporating text onto images with CSS/Bootstrap5

I'm having trouble getting my rows and columns to display on top of my background image. I've been struggling with this issue for a while now. Any assistance on this matter would be greatly appreciated! I'm fairly new to this, so if it&apos ...

Set up Express.js using npm

Just set up nodejs on my Ubuntu 14.04 system. Upon running node --version, I see that it's v4.4.2. Also, npm is installed with version 3.9.2. When I execute the command npm install -g express, this is the output I get: install express js Once the ins ...

Using Bootstrap 4 causes text to wrap buttons onto a separate line

I am facing an issue with my HTML page that displays correctly on medium and large devices but encounters difficulties on smaller screens. When the screen size decreases, the text inside the grey elements takes up all the space, causing the two right-float ...

Adding a CSS class to an HTML element using JQuery

I have a collection of tabs, and I want to dynamically add an <hr> element with the class "break-sec" when a certain class is active. This element should be placed within a <span> element with the class "vc_tta-title-text" after the text. Here ...

Some font-awesome icons are not appearing on the screen

As a beginner in web design, I am experimenting with using font awesome icons in Angular 9 projects within list items. While some of the icons are displaying properly, others are not. You can see the issue in the attached image. To access the icons, I have ...

What is the fastest way to emulate CSS3 box radius for IE in terms of rendering speed?

There are numerous options available in JavaScript, .htc, and jQuery to create rounded corners for IE 6,7,8. (Not compatible with IE 8) http://code.google.com/p/jquerycurvycorners/ http://code.google.com/p/curvycorners/ Which solution offers the faste ...

Access to '/usr/lib/node_modules' has been denied due to error EACCES

Struggling to set up typescript using the command npm install -g typescript, I encountered the following error message: npm ERR! Error: EACCES: permission denied, access '/usr/lib/node_modules' npm ERR! at Error (native) npm ERR! ...

Footer at the bottom and a sticky navigation bar

I have experimented with various CSS guides in order to place the footer at the bottom of the page, and I have found the example below to be the simplest method. html, body, #root { height: 100%; } #root { display: flex; flex-direction: column; } ...

Steps for running an Angular application in IntelliJ:1. Open IntelliJ IDEA

I'm currently navigating through IntelliJ to set up Angular support. https://www.jetbrains.com/help/idea/2017.1/using-angular.html#install_angular_cli After successfully creating the project, I am unsure of how to run it. My guess is that I need to ...

The addControl function inside a for loop and async function is not properly assigning a value to the form

My goal is to iterate through an array, make a HTTP request, retrieve another array from it, and assign the selected object from the fetched array to a newly added Form Control in the form. This is how I approached it: for (let i = 0; i < typeaheadFiel ...