I want to create a dynamic photosphere display within a div, where the source is determined by a selection from a drop-down menu.
The select menu will provide options for different rooms that the user can view, and the div will contain an iframe to showcase the photosphere.
Here is my current code snippet, although it is not functioning as expected:
<!-- SCRIPT FOR PHOTOSPHERE-->
<script>
$(document).ready(function(){
// SELECT MENU
$("#mySelect").change(function(){
var value = $(this).val();
//IFRAME TAG
$("#myPhotoSphere").attr
var src = ($(this).attr('src') === 'photosphere_example.png')
$(this).attr('src', src);
// Define sources based on selected room:
if(value == "1")
{ $("#myPhotoSphere").attr("src","http://orb.photo/embedded_player.php?view=201712011cb4f0e032532a59807bea088f9ca145"); }
else if(value == "2")
{ $("#myPhotoSphere").attr("src","http://orb.photo/embedded_player.php?view=20171201a1da59af307b44fa6dfa5ab2dfc157bd"); }
else if(value == "3")
{ $("#myPhotoSphere").attr("src","http://orb.photo/embedded_player.php?view=2017120169fafbe2c0a507bbb06284857b3ea427"); }
else if(value == "4")
{ $("#myPhotoSphere").attr("src","http://orb.photo/embedded_player.php?view=20171201a5853f710927d4a6b13909117b9ac85a"); }
else if(value == "5")
{ $("#myPhotoSphere").attr("src"," http://orb.photo/embedded_player.php?view=20171201b19318b56e5168ce54ee5a2cc024c798"); }
});
});
</script>
Below you'll find the HTML markup:
<!-- VIRTUAL TOUR -->
<select id="mySelect">
<option value ="" disabled selected> Select a PhotoSphere </option>
<option value="1"> Computing Classroom </option>
<option value="2"> Common Room </option>
<option value="3"> Lecture Theatre </option>
<option value="4"> Atrium </option>
<option value="5"> Coffee Shop </option>
</select>
<div>
<iframe id="myPhotoSphere" src="http://orb.photo/embedded_player.php?view=201712011cb4f0e032532a59807bea088f9ca145" frameborder="0" scrolling="no" width="900" height="600">Please enable iframes to view content.</iframe>
</div>
I'm currently stuck at a point where I am uncertain how to proceed, especially in terms of implementing jQuery functionalities. Any guidance would be greatly appreciated! (I'm relatively new to this programming concept).
Please forgive any errors or oversights made in my attempt thus far...