Language change does not work on mobile

2 replies · opened Oct 31, 2019

AalecorsiOct 31, 2019

I created my site with your theme https://www.topitalianmortgage.com, but I have a problem with the Mobile version. There is a flag In the topbar that changes the language of the site. It works perfectly in the dekstop but it does not work if you visit the site from the mobilephone. The code of the topbar is the following:


						
							
- [EN](#)
								
									
									
- [
![attachment](images/icons/flags/italian.png)
 IT](https://topitalianmortgage.com/it/)
									
								
							
						
					
SSemicolon WebSTAFFOct 31, 2019

Hello,

The issue appears to be with the touchend JS Code which is only prone to Android Devices.

To fix this, please find the following code in the js/functions.js File inside the menufunctions: function() Function Block:

if( $('.top-links').hasClass('on-click') || ( $body.hasClass('device-md') || $body.hasClass('device-sm') || $body.hasClass('device-xs') ) ) {
	$('.top-links:not(.on-click) > ul').superfish('destroy');
	$('.top-links li:has(ul,.top-link-section) > a').on( 'click touchend', function(e){
		$(this).parents('li').siblings().find('ul,.top-link-section').removeClass('d-block');
		$(this).parent('li').children('ul,.top-link-section').toggleClass('d-block');
		e.preventDefault();
	});
}

and replace it with:

if( $('.top-links').hasClass('on-click') || ( $body.hasClass('device-md') || $body.hasClass('device-sm') || $body.hasClass('device-xs') ) ) {
	$('.top-links:not(.on-click) > ul').superfish('destroy');
	$('.top-links li:has(ul,.top-link-section) > a').on( 'click', function(e){
		$(this).parents('li').siblings().find('ul,.top-link-section').removeClass('d-block');
		$(this).parent('li').children('ul,.top-link-section').toggleClass('d-block');
		e.preventDefault();
	});

	$(document).on('click', function(event) {
		if (!$(event.target).closest('.top-links li:has(ul.d-block,.top-link-section.d-block)').length) { $('.top-links li').children('ul,.top-link-section').toggleClass('d-block', false); }
	});
}

This will definitely work fine. Hope this Helps!

Let us know if we can help you with anything else or if you find any further issues.

AalecorsiOct 31, 2019

It's works perfectly, thanks

Have the same question, or something new?

Sign in to the Canvas dashboard to reply or open your own topic. Canvas owners get direct help from the SemiColonWeb team.

Reply on the dashboard