Looking for a Plugin that Can Responsively Display Images in a Vertical Layout - Does One Exist using Jquery

Looking for a gallery slider plugin that is responsive both horizontally and vertically. Have tried Flexslider1/2, Galleria, and others but they do not adjust to vertical resizing. Changing the CSS did not help.

If you resize the browser horizontally with Flexslider, images will adjust accordingly, but resizing vertically cuts off the image. The goal is for images to maintain aspect ratio and fit within the browser window when resizing vertically or horizontally.

Any assistance would be greatly appreciated. If more clarification is needed, please ask instead of downvoting

Answer №1

After exploring the code in Flexslider, it seems that there is no specific exclusion preventing image resizing on vertical window changes. The image resize process appears to be purely CSS-based, feeding width and height information into the JavaScript. It appears that the issue lies in a combination of DOM/CSS problems with browsers not resizing images on vertical window changes, along with potential compatibility issues with FlexSlider.

Getting all browsers to understand 100% vertical layouts without vertical scrolling has always been a bit challenging, as it deviates from the normal layout paradigm. While newer CSS versions have improved this situation somewhat, there can still be discrepancies in how different browsers interpret a 100% layout design.

To tackle this issue, I utilized the slider demo and referenced a stack answer to achieve a successful implementation of a 100% vertical layout. You can view the final result here.

Initially, adjusting the image CSS properties to scale the height while keeping the width auto helped improve the layout's aspect:

width: auto;
height: 90%;

However, additional tweaks were required within the FlexSlider JavaScript to ensure proper handling of the elements. By modifying the CSS values and structure as follows:

.flexslider .slides { width: 100%; display: block;}
.img {display: block; }

The slideshow began functioning correctly in Chrome. For Firefox, further adjustments were necessary to apply the 100% height rule consistently across various elements:

.flexslider .slides {height: 100%; width: 100%; display: block;}
.img {display: block; }

.flex-viewport img{ height: 100%;}
.flex-viewport li { height: 100%;}
.flex-viewport ul { height: 100%;}
.flex-viewport { height: 100%;}

These modifications resolved the resizing issues for Firefox as well. However, one limitation of this solution is that the resized image may extend beyond the screen's horizontal boundaries, potentially causing display issues. It is advisable to anticipate and address such scenarios to prevent functionality disruptions, especially when utilizing carousel features. Please also note that some quirks may arise during user interactions, such as mouseOut events triggering unexpected horizontal scroll bars.

In conclusion, front-end development can present challenges like these, highlighting the complexities involved in ensuring consistent cross-browser compatibility and responsive design. Despite its intricacies, solving such issues can be rewarding and contribute to a more seamless user experience.

I hope this detailed explanation sheds light on the process behind addressing image resizing in FlexSlider setups. If you encounter any further difficulties or have additional questions, please feel free to reach out. Thank you for your patience and understanding throughout this exploration.

Answer №2

I was searching for a vertically and horizontally responsive image slider but couldn't find one that met my requirements, so I decided to create my own solution.

You can view the final product here.

Below are the key components (refer to the jsFiddle for the complete demonstration). While it's not flawless, it should serve as a good starting point.

HTML

<div id="fader">
    <a href="http://url1.com"><img src="http://placehold.it/600x600&text=Slide1" ></a>
    <a href="http://url2.com"><img src="http://placehold.it/600x600&text=Slide2" ></a>
    <a href="http://url3.com"><img src="http://placehold.it/600x600&text=Slide3" ></a>
    <a href="http://url4.com"><img src="http://placehold.it/600x600&text=Slide4" ></a>
</div>

CSS

#fader {
    position: relative; 
    width: auto;
    height: 100%;
}

#fader a {
    display:block;
    width:auto;
    height:100%;    
}

@media screen and (orientation: portrait) {
  img { 
      width: 100%; 
      height:auto !important;
  }
}
@media screen and (orientation: landscape) {
  img { 
      height: 100%;
      min-width:10%;
      max-width:100%;
  }
}

A big shoutout to this jsFiddle which provided the lightweight jQuery rotator referenced in the project.

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

What could be causing this Angular controller to throw the error message "Error: Unknown provider: nProvider <- n"?

Check out the jsFiddle code here: <div ng-app=""> <div ng-controller="FirstCtrl"> <input type="text" ng-model="data.message" /> {{data.message + " world"}} </div> </div> function FirstCtrl($scope) { ...

Using AngularJS to dynamically swap out {{post.title}} with a different HTML file

I want to update the value of {{post.title}} within my HTML to redirect to another HTML file. <div ng-repeat="post in posts"> <h2> {{post.title}} <a ng-click="editPost(post._id)" class="pull-r ...

Tips for including <script> tags in Angular2

Is there a way to integrate the following script into my Angular page: <script> jQuery(function () { jQuery('#camera_wrap_1').camera({ transPeriod: 500, time: 3000, height: '490px', thumbnails: ...

Angular's innerHTML dilemma

Within my Angular service, I have implemented three methods as shown below: public loadLiveChat() { let url: string; url = this.appConfig.config.liveAgent.liveAgentScriptUrl; this.dynamicallyLoadScript(url); ...

The function window.location.reload(true) is failing to properly refresh the page

Currently, I have a PHP page that retrieves data from a MYSQL database and creates HTML content based on the returned rows. I recently implemented a feature where clicking a button adds a new row to the database using AJAX, jQuery, and PHP. However, after ...

Trouble with AngularJS Smart Table when dealing with live data streams

Currently, I am facing a scenario where I am utilizing angularJs smart table for filtering. Here is the HTML code: <section class="main" ng-init="listAllWorkOrderData()"> <table st-table="listWorkOrderResponse"> <thead> ...

Developing components with jQuery

I have a JavaScript program that works perfectly when I use the following line of code: li = $("<li data-role='collapsible' data-iconpos='right' data-inset='false'></li>"); However, if I change the above line ...

Retrieving form data in Servlet

Just began working with servlets and encountered an issue. I am trying to upload a file to my server using a servlet, while also sending a text value (the file name) to be changed on the server side. The problem arises when I submit the form data to the se ...

When attempting to use the $http get command, an error may occur due

Is there a way to capture these errors in an Ionic application? ionic.bundle.js:25000 GET net::ERR_CONNECTION_REFUSED Using the following code snippet: $http.get('http://' + ip + '/?custom=1&cmd=' + cmd); I have attempted var ...

Troubleshooting: AngularJS routing issue

I'm facing an issue with my AngularJS routing code. Here is the code snippet: /// <reference path="C:\Users\elwany\documents\visual studio 2015\Projects\spaapplication\spaapplication\scripts/angular.js" /& ...

How to Retrieve Grandparent Component Attributes in Angular Using Grandchild Components

I am constructing an Angular application and facing the challenge of accessing a property of Component 1 within Component 3. In this scenario, the relationship is described as grandparent-grandchild. Successfully establishing communication between parent/ ...

I'm curious if there's a method to ensure that the content within a mat-card stays responsive

So I'm working with this mat-card: <mat-card> <mat-card-content> <div *ngFor="let siteSource of siteSources | paginate: { itemsPerPage: 5, currentPage: page};"> <site-details [site]='siteSource'></s ...

Incorporating style elements into text box content

I am looking to enhance my form by enabling users to format text, add lists, and more using basic HTML functionality without requiring knowledge of HTML. For example, let's consider the Bold button: <div class="goBold button">B</div> < ...

Creating a custom useStorage hook to easily save a Set data type in local storage

I attempted to make modifications to the code found at this reference link: useLocalStorage hook my goal was to enable saving a Set() to localStorage. useLocalStorage.js import { useState, useEffect } from "react"; // Custom Hook export const ...

Duplicate values of React object properties when using .push method within a loop

In my code, I've implemented a function called handleCreate that is responsible for taking user data and inserting it into a database. Within the loop of aliasArr.forEach(), I am sending new user instances to my database for each element in the alias ...

Manipulating input dates in AngularJSIn AngularJS, we can easily set the value

I'm having trouble setting a date field in my code. Despite trying to follow the example provided in the AngularJS documentation, nothing is showing up in the "departure" field. Here is what I have: HTML: <input type="date" name="departure" ng-mo ...

Having trouble getting Highcharts SVG element to refresh? Looking to incorporate custom freeform drawing features within Highcharts?

I have implemented highchart for graph rendering and utilized the renderer to draw a custom line within the chart. I am looking for a way to recalculate and repaint this path whenever there is a change in data. The framework being used is highcharts-ng alo ...

Is there a common issue in web browsers? Neglecting the position relative attribute on 'tbody', 'tr', and 'td' elements?

Trying to absolutely position elements within tbody, tr, and td may not work in certain browsers. While it behaves as expected in Firefox, it does not work properly in IE, Edge, and Chrome. If you apply position: relative to tbody, tr, or td, it will be i ...

Retrieving PokéAPI image information

My goal is to display images from the PokéAPI on my app's homescreen when it is opened. However, I am facing a challenge where I need to call 30 different APIs in order to show 30 images. Calling these APIs one after another every few seconds seems l ...

Angular 2 - The creation of cyclic dependencies is not allowed

Utilizing a custom XHRBackend class to globally capture 401 errors, I have encountered a dependency chain issue in my code. The hierarchy is as follows: Http -> customXHRBackend -> AuthService -> Http. How can this problem be resolved? export cla ...