193
193
box-shadow : 0 25px 50px rgba (139 , 92 , 246 , 0.25 );
194
194
}
195
195
196
+ /* Mobile-specific styles */
197
+ @media (max-width : 768px ) {
198
+ .mobile-vertical {
199
+ flex-direction : column !important ;
200
+ width : 100vw !important ;
201
+ height : auto !important ;
202
+ transform : none !important ;
203
+ transition : none !important ;
204
+ }
205
+
206
+ .mobile-vertical section {
207
+ width : 100vw !important ;
208
+ height : 100vh !important ;
209
+ min-height : 100vh ;
210
+ }
211
+
212
+ .scroll-indicator {
213
+ display : none;
214
+ }
215
+
216
+ body {
217
+ overflow-y : auto;
218
+ overflow-x : hidden;
219
+ }
220
+
221
+ .card-hover : hover {
222
+ transform : none;
223
+ box-shadow : 0 10px 25px rgba (139 , 92 , 246 , 0.15 );
224
+ }
225
+ }
196
226
/* Progress indicator */
197
227
.progress-dot {
198
228
transition : all 0.3s ease;
233
263
} ;
234
264
</ script >
235
265
</ head >
236
- < body class ="bg-slate-900 text-slate-200 overflow-hidden font-inter ">
266
+ < body
267
+ class ="bg-slate-900 text-slate-200 overflow-hidden md:overflow-hidden font-inter "
268
+ >
237
269
<!-- Progress Indicator -->
238
270
< div class ="scroll-indicator ">
239
271
< div class ="flex flex-col space-y-3 ">
289
321
290
322
< main
291
323
id ="slider-container "
292
- class ="flex w-[1100vw] h-screen transition-transform duration-1000 relative z-10 "
324
+ class ="flex w-[1100vw] h-screen transition-transform duration-1000 relative z-10 md:flex-row flex-col md:w-[1100vw] w-screen md:h-screen h-auto "
293
325
style ="transition-timing-function: cubic-bezier(0.86, 0, 0.07, 1) "
294
326
>
295
327
<!-- Slide 1: Hero -->
@@ -879,6 +911,51 @@ <h4 class="text-blue-400 font-semibold text-xl mb-2">
879
911
let currentSlide = 0 ;
880
912
const totalSlides = 10 ;
881
913
let isThrottled = false ;
914
+ let isMobile = window . innerWidth <= 768 ;
915
+
916
+ // Check if mobile on resize
917
+ window . addEventListener ( "resize" , ( ) => {
918
+ const wasMobile = isMobile ;
919
+ isMobile = window . innerWidth <= 768 ;
920
+
921
+ if ( wasMobile !== isMobile ) {
922
+ setupLayout ( ) ;
923
+ }
924
+ } ) ;
925
+
926
+ // Setup layout based on device
927
+ function setupLayout ( ) {
928
+ if ( isMobile ) {
929
+ slider . classList . add ( "mobile-vertical" ) ;
930
+ slider . style . transform = "none" ;
931
+ document . body . style . overflow = "auto" ;
932
+ document . body . style . overflowX = "hidden" ;
933
+
934
+ // Disable horizontal scrolling functionality
935
+ window . removeEventListener ( "wheel" , handleScroll ) ;
936
+ window . removeEventListener ( "keydown" , handleKeyPress ) ;
937
+
938
+ // Hide progress dots on mobile
939
+ progressDots . forEach ( ( dot ) => {
940
+ dot . style . display = "none" ;
941
+ } ) ;
942
+ } else {
943
+ slider . classList . remove ( "mobile-vertical" ) ;
944
+ document . body . style . overflow = "hidden" ;
945
+
946
+ // Enable horizontal scrolling functionality
947
+ window . addEventListener ( "wheel" , handleScroll , { passive : true } ) ;
948
+ window . addEventListener ( "keydown" , handleKeyPress ) ;
949
+
950
+ // Show progress dots on desktop
951
+ progressDots . forEach ( ( dot ) => {
952
+ dot . style . display = "block" ;
953
+ } ) ;
954
+
955
+ // Reset to current slide position
956
+ slider . style . transform = `translateX(-${ currentSlide * 100 } vw)` ;
957
+ }
958
+ }
882
959
883
960
// Create floating particles
884
961
function createParticles ( ) {
@@ -895,6 +972,8 @@ <h4 class="text-blue-400 font-semibold text-xl mb-2">
895
972
896
973
// Update progress indicator
897
974
function updateProgress ( ) {
975
+ if ( isMobile ) return ; // Don't update progress on mobile
976
+
898
977
progressDots . forEach ( ( dot , index ) => {
899
978
if ( index === currentSlide ) {
900
979
dot . classList . add ( "active" ) ;
@@ -904,9 +983,9 @@ <h4 class="text-blue-400 font-semibold text-xl mb-2">
904
983
} ) ;
905
984
}
906
985
907
- // Handle scroll with improved smoothness
986
+ // Handle scroll with improved smoothness (desktop only)
908
987
function handleScroll ( event ) {
909
- if ( isThrottled ) return ;
988
+ if ( isMobile || isThrottled ) return ;
910
989
isThrottled = true ;
911
990
setTimeout ( ( ) => {
912
991
isThrottled = false ;
@@ -924,8 +1003,10 @@ <h4 class="text-blue-400 font-semibold text-xl mb-2">
924
1003
updateProgress ( ) ;
925
1004
}
926
1005
927
- // Handle keyboard navigation
1006
+ // Handle keyboard navigation (desktop only)
928
1007
function handleKeyPress ( event ) {
1008
+ if ( isMobile ) return ;
1009
+
929
1010
if ( event . key === "ArrowRight" || event . key === " " ) {
930
1011
event . preventDefault ( ) ;
931
1012
if ( currentSlide < totalSlides - 1 ) {
@@ -943,44 +1024,41 @@ <h4 class="text-blue-400 font-semibold text-xl mb-2">
943
1024
}
944
1025
}
945
1026
946
- // Handle progress dot clicks
1027
+ // Handle progress dot clicks (desktop only)
947
1028
progressDots . forEach ( ( dot , index ) => {
948
1029
dot . addEventListener ( "click" , ( ) => {
1030
+ if ( isMobile ) return ;
949
1031
currentSlide = index ;
950
1032
slider . style . transform = `translateX(-${ currentSlide * 100 } vw)` ;
951
1033
updateProgress ( ) ;
952
1034
} ) ;
953
1035
} ) ;
954
1036
955
- // Initialize
956
- window . addEventListener ( "wheel" , handleScroll , { passive : true } ) ;
957
- window . addEventListener ( "keydown" , handleKeyPress ) ;
958
- createParticles ( ) ;
959
- updateProgress ( ) ;
960
-
961
- // Add touch/swipe support for mobile
1037
+ // Touch/swipe support (desktop only - mobile uses native scroll)
962
1038
let touchStartX = 0 ;
963
1039
let touchEndX = 0 ;
964
1040
965
1041
slider . addEventListener ( "touchstart" , ( e ) => {
1042
+ if ( isMobile ) return ;
966
1043
touchStartX = e . changedTouches [ 0 ] . screenX ;
967
1044
} ) ;
968
1045
969
1046
slider . addEventListener ( "touchend" , ( e ) => {
1047
+ if ( isMobile ) return ;
970
1048
touchEndX = e . changedTouches [ 0 ] . screenX ;
971
1049
handleSwipe ( ) ;
972
1050
} ) ;
973
1051
974
1052
function handleSwipe ( ) {
1053
+ if ( isMobile ) return ;
1054
+
975
1055
const swipeThreshold = 50 ;
976
1056
const diff = touchStartX - touchEndX ;
977
1057
978
1058
if ( Math . abs ( diff ) > swipeThreshold ) {
979
1059
if ( diff > 0 && currentSlide < totalSlides - 1 ) {
980
- // Swipe left - go to next slide
981
1060
currentSlide ++ ;
982
1061
} else if ( diff < 0 && currentSlide > 0 ) {
983
- // Swipe right - go to previous slide
984
1062
currentSlide -- ;
985
1063
}
986
1064
slider . style . transform = `translateX(-${ currentSlide * 100 } vw)` ;
@@ -1003,6 +1081,11 @@ <h4 class="text-blue-400 font-semibold text-xl mb-2">
1003
1081
} ) ;
1004
1082
} , observerOptions ) ;
1005
1083
1084
+ // Initialize
1085
+ createParticles ( ) ;
1086
+ setupLayout ( ) ;
1087
+ updateProgress ( ) ;
1088
+
1006
1089
// Observe all animated elements
1007
1090
document . querySelectorAll ( ".card-hover, .glass" ) . forEach ( ( el ) => {
1008
1091
observer . observe ( el ) ;
0 commit comments