×

Notice

The forum is in read only mode.
Welcome, Guest
Username: Password: Remember me
  • Page:
  • 1

TOPIC: Change default view from Map to Photo?

Change default view from Map to Photo? 12 years 9 months ago #13053

  • Preston
  • Preston's Avatar Topic Author
  • Offline
  • Fresh Boarder
  • Fresh Boarder
  • Posts: 18
  • Thank you received: 0
When clicking "Read More" in the marker pop up, it takes me to the description page for the marker and the default view is the Map tab. I want to change this to the Photo tab.

Change default view from Map to Photo? 12 years 9 months ago #13086

  • Daniel Dimitrov
  • Daniel Dimitrov's Avatar
  • Offline
  • Administrator
  • Administrator
  • Posts: 9618
  • Karma: 155
  • Thank you received: 1081
Use a template override for hotspot/tmpl/default.php and reverse the order of the ul creating the tab.
From
	<ul class="tab-details-tabs"><li class="tab-details-tab" data-id="map"><span><?php echo JText::_('COM_HOTSPOTS_MAP_SINGLE_VIEW_TAB'); ?></span></li><?php if ($this->hotspot->picture) : ?><li class="tab-details-tab" data-id="photo"><span><?php echo JText::_('COM_HOTSPOTS_PHOTO'); ?></span></li><?php endif; ?></ul>
to
<ul class="tab-details-tabs"><?php if ($this->hotspot->picture) : ?><li class="tab-details-tab" data-id="photo"><span><?php echo JText::_('COM_HOTSPOTS_PHOTO'); ?></span></li><?php endif; ?><li class="tab-details-tab" data-id="map"><span><?php echo JText::_('COM_HOTSPOTS_MAP_SINGLE_VIEW_TAB'); ?></span></li></ul>

Re: Change default view from Map to Photo? 12 years 2 months ago #15297

  • romuald touitou
  • romuald touitou's Avatar
  • Offline
  • Fresh Boarder
  • Fresh Boarder
  • Posts: 1
  • Thank you received: 0
Hi there,

I tried that code and those 2 tabs are reversed but :

- it still loads the map first on photo tab
- I have to click again on photo tab to load the picture

Can you help me with that ?

Romuald

Re: Change default view from Map to Photo? 12 years 2 months ago #15318

  • Daniel Dimitrov
  • Daniel Dimitrov's Avatar
  • Offline
  • Administrator
  • Administrator
  • Posts: 9618
  • Karma: 155
  • Thank you received: 1081
Ok, it was a little more complicated than that...
you also need to change the <div class="tab-details-tab-content" data-id="map"> and <div class="tab-details-tab-content" data-id="photo"> . The div with the photo needs to come first.
We also need to change the javascript a little bit otherwise google maps won't be able to properly function:
 
 
$domready = "window.addEvent('domready', function(){ \n";
 
$domready .= hotspotsUtils::getJsLocalization() . "\n";
$domready .= hotspotsUtils::getJSVariables() . "\n";
$domready .= 'var hotspot = ' . json_encode($hotspot) . ';' . "\n";
//$domready .= "Hotspots.Single = new Hotspots.Hotspot(Hotspots.DefaultOptions, 'map_canvas', hotspot); " . "\n";
//$domready .= "var layout = new Hotspots.Layout.Hotspot(Hotspots.DefaultOptions, Hotspots.Single); layout.menu();layout.directions();" . "\n";
$domready .= "var tabs = new Hotspots.Tab('tab-details',{
			tabSelector: '.tab-details-tab',
			contentSelector: '.tab-details-tab-content'
		});
		var initialized = false;
		var photo = false;
		document.id('tab-details').getElements('.tab-details-tab-content').each(function(el){
			if(el.get('data-id') == 'photo') {			
				photo = true;
			}
		});
 
		tabs.addEvent('change', function(el) {
 
			if(el == 'map') {
 
				if(initialized == false) {
					Hotspots.Single = new Hotspots.Hotspot(Hotspots.DefaultOptions, 'map_canvas', hotspot); 
					var layout = new Hotspots.Layout.Hotspot(Hotspots.DefaultOptions, Hotspots.Single); layout.menu();layout.directions();
					initialized = true;
				}
			}
		});
 
		if(photo == false) {
			tabs.fireEvent('change', 'map');
		}
 
		";
$domready .= "});";

@romuald - I've modified your template override so everything should be fine at your end.

Cheers,
Daniel
The following user(s) said Thank You: romuald touitou
  • Page:
  • 1
Time to create page: 0.163 seconds