Skip to content

Instantly share code, notes, and snippets.

@wurwal
Created April 29, 2025 16:09
Show Gist options
  • Save wurwal/c840e3262e5528f8df3b333eb6abfcd2 to your computer and use it in GitHub Desktop.
Save wurwal/c840e3262e5528f8df3b333eb6abfcd2 to your computer and use it in GitHub Desktop.
jQuery(".pin-0").click(function(){
point = 0;
jQuery(".infobox").removeClass("show-flex");
jQuery(".pin").attr("src","https://tribe-manchesterairport.co.uk/wp-content/uploads/2025/04/pin.svg");
jQuery(".infobox-0").addClass("show-flex");
jQuery(".pin-0").attr("src","https://tribe-manchesterairport.co.uk/wp-content/uploads/2025/04/pin-active.svg");
});
jQuery(".pin-1").click(function(){
point = 1;
jQuery(".infobox").removeClass("show-flex");
jQuery(".pin").attr("src","https://tribe-manchesterairport.co.uk/wp-content/uploads/2025/04/pin.svg");
jQuery(".infobox-1").addClass("show-flex");
jQuery(".pin-1").attr("src","https://tribe-manchesterairport.co.uk/wp-content/uploads/2025/04/pin-active.svg");
});
jQuery(".pin-2").click(function(){
point = 2;
jQuery(".infobox").removeClass("show-flex");
jQuery(".pin").attr("src","https://tribe-manchesterairport.co.uk/wp-content/uploads/2025/04/pin.svg");
jQuery(".infobox-2").addClass("show-flex");
jQuery(".pin-2").attr("src","https://tribe-manchesterairport.co.uk/wp-content/uploads/2025/04/pin-active.svg");
});
jQuery(".pin-3").click(function(){
point = 3;
jQuery(".infobox").removeClass("show-flex");
jQuery(".pin").attr("src","https://tribe-manchesterairport.co.uk/wp-content/uploads/2025/04/pin.svg");
jQuery(".infobox-3").addClass("show-flex");
jQuery(".pin-3").attr("src","https://tribe-manchesterairport.co.uk/wp-content/uploads/2025/04/pin-active.svg");
});
jQuery(".pin-4").click(function(){
point = 4;
jQuery(".infobox").removeClass("show-flex");
jQuery(".pin").attr("src","https://tribe-manchesterairport.co.uk/wp-content/uploads/2025/04/pin.svg");
jQuery(".infobox-4").addClass("show-flex");
jQuery(".pin-4").attr("src","https://tribe-manchesterairport.co.uk/wp-content/uploads/2025/04/pin-active.svg");
});
jQuery(".pin-5").click(function(){
point = 5;
jQuery(".infobox").removeClass("show-flex");
jQuery(".pin").attr("src","https://tribe-manchesterairport.co.uk/wp-content/uploads/2025/04/pin.svg");
jQuery(".infobox-5").addClass("show-flex");
jQuery(".pin-5").attr("src","https://tribe-manchesterairport.co.uk/wp-content/uploads/2025/04/pin-active.svg");
});
jQuery(".pin-6").click(function(){
point = 6;
jQuery(".infobox").removeClass("show-flex");
jQuery(".pin").attr("src","https://tribe-manchesterairport.co.uk/wp-content/uploads/2025/04/pin.svg");
jQuery(".infobox-6").addClass("show-flex");
jQuery(".pin-6").attr("src","https://tribe-manchesterairport.co.uk/wp-content/uploads/2025/04/pin-active.svg");
});
jQuery(".pin-7").click(function(){
point = 7;
jQuery(".infobox").removeClass("show-flex");
jQuery(".pin").attr("src","https://tribe-manchesterairport.co.uk/wp-content/uploads/2025/04/pin.svg");
jQuery(".infobox-7").addClass("show-flex");
jQuery(".pin-7").attr("src","https://tribe-manchesterairport.co.uk/wp-content/uploads/2025/04/pin-active.svg");
});
jQuery(".pin-8").click(function(){
point = 8;
jQuery(".infobox").removeClass("show-flex");
jQuery(".pin").attr("src","https://tribe-manchesterairport.co.uk/wp-content/uploads/2025/04/pin.svg");
jQuery(".infobox-8").addClass("show-flex");
jQuery(".pin-8").attr("src","https://tribe-manchesterairport.co.uk/wp-content/uploads/2025/04/pin-active.svg");
});
jQuery(".pin-9").click(function(){
point = 9;
jQuery(".infobox").removeClass("show-flex");
jQuery(".pin").attr("src","https://tribe-manchesterairport.co.uk/wp-content/uploads/2025/04/pin.svg");
jQuery(".infobox-9").addClass("show-flex");
jQuery(".pin-9").attr("src","https://tribe-manchesterairport.co.uk/wp-content/uploads/2025/04/pin-active.svg");
});
// prev / next controls
var point = 1;
var maxpoint = 8;
var minpoint = 0;
var mapchangepoint = 4;
//clicking next
jQuery(".pin-next").click(function(){
if (point < maxpoint && point >= minpoint) {
point++;
jQuery(".infobox").removeClass("show-flex");
jQuery(".pin").attr("src","https://tribe-manchesterairport.co.uk/wp-content/uploads/2025/04/pin.svg");
jQuery(".infobox-" +point+ "").addClass("show-flex");
jQuery(".pin-" +point+ "").attr("src","https://tribe-manchesterairport.co.uk/wp-content/uploads/2025/04/pin-active.svg");
}
console.log("you are on map point " +point+ "");
});
//clicking prev
jQuery(".pin-prev").click(function(){
if (point <= maxpoint && point > minpoint) {
point--;
jQuery(".infobox").removeClass("show-flex");
jQuery(".pin").attr("src","https://tribe-manchesterairport.co.uk/wp-content/uploads/2025/04/pin.svg");
jQuery(".infobox-" +point+ "").addClass("show-flex");
jQuery(".pin-" +point+ "").attr("src","https://tribe-manchesterairport.co.uk/wp-content/uploads/2025/04/pin-active.svg");
}
console.log("you are on map point " +point+ "");
});
//zoom ui
jQuery(function($) {
jQuery('.ui-zoom-control--plus').on('click', function() {
jQuery('.map-container-1').show();
jQuery('.map-container-2').hide();
jQuery('.location-toggle-1').addClass('location-toggle-active');
jQuery('.location-toggle-2').removeClass('location-toggle-active');
jQuery('.ui-zoom-control--minus').css('opacity', 0.3);
jQuery('.ui-zoom-control--plus').css('opacity', 1);
});
jQuery('.ui-zoom-control--minus').on('click', function() {
jQuery('.map-container-2').show();
jQuery('.map-container-1').hide();
jQuery('.location-toggle-2').addClass('location-toggle-active');
jQuery('.location-toggle-1').removeClass('location-toggle-active');
jQuery('.ui-zoom-control--minus').css('opacity', 1);
jQuery('.ui-zoom-control--plus').css('opacity', 0.3);
});
});
//tab ui
jQuery(function($) {
jQuery('.location-toggle').on('click', function() {
jQuery('.location-toggle').removeClass('location-toggle-active');
jQuery(this).addClass('location-toggle-active');
});
});
//map changes when map change point threshold is arrived at
jQuery(".ui-pin-nav").click(function(){
console.log("map change point:" +mapchangepoint+ "");
if (point < mapchangepoint) {
jQuery('.map-container-1').show();
jQuery('.map-container-2').hide();
jQuery('.location-toggle-1').addClass('location-toggle-active');
jQuery('.location-toggle-2').removeClass('location-toggle-active');
} else if (point > mapchangepoint) {
jQuery('.map-container-2').show();
jQuery('.map-container-1').hide();
jQuery('.location-toggle-2').addClass('location-toggle-active');
jQuery('.location-toggle-1').removeClass('location-toggle-active');
} else {
// Optional: code to run when mapchangepoint is exactly 6
}
});
jQuery(".ui-pin-nav").click(function(){
if (point === minpoint) {
jQuery('.pin-prev').css('opacity', 0.3);
} else if (point === maxpoint) {
jQuery('.pin-next').css('opacity', 0.3);
} else {
jQuery('.pin-prev').css('opacity', 1);
jQuery('.pin-next').css('opacity', 1);
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment