1+ const selectElement = ( element ) => document . querySelector ( element ) ;
2+
3+ selectElement ( '.mobile-menu' ) . addEventListener ( 'click' , ( ) => {
4+ selectElement ( 'header' ) . classList . toggle ( 'active' ) ;
5+ } ) ;
6+
7+ // ... (previous code)
8+
9+ document . addEventListener ( "DOMContentLoaded" , function ( ) {
10+ const uttarakhandCenter = [ 21.146633 , 79.088860 ] ;
11+ const map = L . map ( 'map' ) . setView ( uttarakhandCenter , 8 ) ;
12+ L . tileLayer ( 'https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png' , {
13+ attribution : '© <a href="https://maps.openweathermap.org/maps/2.0/radar/{z}/{x}/{y}?appid={API key}&tm={date}">OpenStreetMap</a> contributors'
14+ } ) . addTo ( map ) ;
15+
16+
17+
18+ const dehradunCoordinates = [ 21.146633 , 79.088860 ] ;
19+ const redIcon = L . icon ( {
20+ iconUrl : 'pin.png' , // Replace with the actual path to your red pointer PNG
21+ iconSize : [ 32 , 32 ] ,
22+ iconAnchor : [ 16 , 32 ] ,
23+ popupAnchor : [ 0 , - 32 ]
24+ } ) ;
25+ L . marker ( dehradunCoordinates , { icon : redIcon } ) . addTo ( map )
26+ . bindPopup ( 'Dehradun, India' )
27+ . openPopup ( ) ;
28+
29+
30+
31+ const dehradunCoordinates4 = [ 2.146633 , 9.088860 ] ;
32+ L . marker ( dehradunCoordinates4 ) . addTo ( map )
33+ . bindPopup ( 'Nagpur, India' )
34+ . openPopup ( ) ;
35+
36+ const rishikeshCoordinates = [ 18.516726 , 73.856255 ] ;
37+ L . marker ( rishikeshCoordinates ) . addTo ( map )
38+ . bindPopup ( 'Pune, India' )
39+ . openPopup ( ) ;
40+
41+ const rishikeshCoordinates2 = [ 22.719568 , 75.857727 ] ;
42+ L . marker ( rishikeshCoordinates2 ) . addTo ( map )
43+ . bindPopup ( 'Indore, India' )
44+ . openPopup ( ) ;
45+
46+ const rishikeshCoordinates3 = [ 33.738045 , 73.084488 ] ;
47+ L . marker ( rishikeshCoordinates3 ) . addTo ( map )
48+ . bindPopup ( 'Indore, India' )
49+ . openPopup ( ) ;
50+
51+ // Add event listener for form submission
52+ document . getElementById ( 'location-form' ) . addEventListener ( 'submit' , function ( e ) {
53+ e . preventDefault ( ) ;
54+
55+ const selectedStation = document . getElementById ( 'station' ) . value ;
56+
57+ if ( selectedStation === 'Mussoorie' ) {
58+ const mussoorieCoordinates = [ 30.4591 , 78.0667 ] ;
59+ map . setView ( mussoorieCoordinates , 12 ) ;
60+ }
61+ } ) ;
62+ } ) ;
63+
64+
0 commit comments