Check out the demo here.
The purpose of this script is to automatically adjust image sizes based on window size, ensuring consistent proportions across different screen resolutions.
Here are some challenges I have encountered with it and I am seeking solutions to improve its elegance and smoothness:
- While it works well in larger resolutions (1280+), issues arise when viewed in 1024 or lower resolutions.
- Scrolling behavior is not as smooth as desired.
- Issues with alignment, such as white border disappearance in '3-up' or '4-up' views at 1680 resolution.
- Misalignment occurs when reaching the end of a scroll in '4-up' view.
- There is repetitive code that needs refining for multiple views.
- Initial loading time takes approximately 3 seconds, showing smaller versions before resizing them, which appears untidy.
- Seeking general optimization tips for smoother functionality.
You can view the relevant parts below, or examine the source code on the feedback page:
HTML:
<div id="compare_view" align="center">
<!-- HTML content omitted for brevity -->
</div>
CSS:
#slider-code {
/* CSS styles omitted for brevity */
}
/* Additional CSS rules omitted for brevity */
#compare_view .compv-navbar img {
/* CSS styles omitted for brevity */
}
JS:
/* JS code omitted for conciseness */
I placed the JavaScript inside the window.load function to ensure proper detection of window size for image resizing. Your input and suggestions would be greatly appreciated!
Thank you.
Edit: Looking for assistance to resolve new issues after implementing suggested changes.
Edit 2: Facing challenges with recent modifications, seeking guidance to restore functionality. Visit the link above to see the updated version.