Front page images (jQuery) not working when language filter

General questions regarding the use of languages in Joomla! 2.5.

Moderator: General Support Moderators

Forum rules
Forum Rules
Absolute Beginner's Guide to Joomla! <-- please read before posting, this means YOU.
Forum Post Assistant - If you are serious about wanting help, you will use this tool to help you post.
Locked
User avatar
IberoMedia
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 126
Joined: Mon Apr 12, 2010 3:25 am
Contact:

Front page images (jQuery) not working when language filter

Post by IberoMedia » Thu Oct 06, 2011 9:07 pm

Hello,

I designed a front page that uses jQuery for the animation of some images. When I enabled the language filter plugin, the front page animation of these images is no longer working. The images are supposed to toggle.

In the jQuery file I am calling the images this way:

Code: Select all

jQuery("#plan img", jQuery('#tabs')).hover(
		function(event) { jQuery(this).attr("src","images/web-design/small-business-web-design/small-business-web-design-plan-active.png");},
		function(event) { jQuery(this).attr("src","
images/web-design/small-business-web-design/small-business-web-design-plan.png");});
	jQuery("#execute img", jQuery('#tabs')).hover(
		function(event) { jQuery(this).attr("src","images/web-design/small-business-web-design/small-business-web-design-execute-active.png");},
		function(event) { jQuery(this).attr("src","images/web-design/small-business-web-design/small-business-web-design-execute.png");});
	jQuery("#support img", jQuery('#tabs')).hover(
		function(event) { jQuery(this).attr("src","images/web-design/small-business-web-design/small-business-web-design-support-active.png");},
		function(event) { jQuery(this).attr("src","images/web-design/small-business-web-design/small-business-web-design-support.png");});
As you can read, the src of the image is changed from:

images/web-design/small-business-web-design/small-business-web-design-plan-active.png

to:

images/web-design/small-business-web-design/small-business-web-design-plan.png

Should this url be different due to the language filter? (For example, the addition of the en for english)

Thank you

User avatar
infograf768
Joomla! Master
Joomla! Master
Posts: 19133
Joined: Fri Aug 12, 2005 3:47 pm
Location: **Translation Matters**

Re: Front page images (jQuery) not working when language fil

Post by infograf768 » Fri Oct 07, 2011 5:18 am

I do not see how this could be related to multilanguage.
I am not JQuery expert, but the links above are links to a folder containing images ( images/web-design/small-business-web-design/ ) and you control this src, not the language filter.
Jean-Marie Simonet / infograf
---------------------------------
ex-Joomla Translation Coordination Team • ex-Joomla! Production Working Group

User avatar
IberoMedia
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 126
Joined: Mon Apr 12, 2010 3:25 am
Contact:

Re: Front page images (jQuery) not working when language fil

Post by IberoMedia » Fri Oct 07, 2011 10:16 pm

@infograf768 thank you.

Perhaps this sheds some light on what is happening, if I enter the source of the images with the absolute path, i.e. http://domain.com/images/web-design..., the module displays the animation of the images correctly.

As is, relative url path (images/web-design/small-business-web-design/small-business-web-design-plan.png). he jQuery works, meaning the animation occurs. It is the images that are not fetch through the relative path. But as I mentioned before, the images do not change correctly when the Language Filter plug in is enabled.

Do you think that adding /en/, or /es/ in the case of Spanish, changes how the path image path would be found?

Thank you,

User avatar
infograf768
Joomla! Master
Joomla! Master
Posts: 19133
Joined: Fri Aug 12, 2005 3:47 pm
Location: **Translation Matters**

Re: Front page images (jQuery) not working when language fil

Post by infograf768 » Sat Oct 08, 2011 9:28 am

IberoMedia wrote:.
Do you think that adding /en/, or /es/ in the case of Spanish, changes how the path image path would be found?
I would not think this is the solution as your code above does not use the lang prefix anyway.
One solution could be to force the use of the absolute path by adding before the '/images/web-design/small-business-web-design/whatever'
JPATH_SITE or JPATH_ROOT
Jean-Marie Simonet / infograf
---------------------------------
ex-Joomla Translation Coordination Team • ex-Joomla! Production Working Group

electrocity
Joomla! Intern
Joomla! Intern
Posts: 53
Joined: Sat Mar 06, 2010 8:21 pm
Contact:

Re: Front page images (jQuery) not working when language fil

Post by electrocity » Tue Oct 11, 2011 1:07 pm

By joomla 1.7 when activate the language filters,
I have same type of bug with jQuery.

siteurl+'index.php?option=com_virtuemart
is changed to
siteurl+'index.php/fr/?option=com_virtuemart

siteurl = JURI::root(true).'/'
tested
siteurl = JURI::root()
with same bug

in joomla 1.5 and joomfish i don't have this problem


But strange is this is only in Internet Explorer.
the URL is rewrited on the fly by IE 9.0 (code itself is not affected) and the ajax do not find the response.

If i copy past the rewrited IE link in the browser the result is correct
IE debug give this code:

Code: Select all

<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8" /><script>document.location.href='http://localhost/j17vm2RC2/index.php/fr/?option=com_virtuemart&view=cart&task=addJS&format=json&quantity%5B%5D=1&option=com_virtuemart&view=cart&virtuemart_product_id%5B%5D=3&virtuemart_manufacturer_id=1&virtuemart_category_id%5B%5D=3';</script></head><body></body></html>
for this ajax request
GET /j17vm2RC2/index.php?option=com_virtuemart&view=cart&task=addJS&format=json&quantity%255B%255D%3D1%26option%3Dcom_virtuemart%26view%3Dcart%26virtuemart_product_id%255B%255D%3D3%26virtuemart_manufacturer_id%3D1%26virtuemart_category_id%255B%255D%3D3 HTTP/1.1
Someone posted me a solution

Code: Select all

$lang =& JFactory::getLanguage();
$locales = $lang->getLocale();
$lg = explode('_',$locales[0]);
$JOOMLA_LANGUAGE = $lg[0];
$jsVars  = "siteurl = '". JURI::root(true) . '/' . $JOOMLA_LANGUAGE . '/' . "' ;\n" ;
But i find is a general BUG, not a virtuemart related bug

Tks for you're Work.


Patrick Kohl , Virtuemart dev team.
Free and paid Joomla & virtuemart extensions https://shop.st42.fr/en

electrocity
Joomla! Intern
Joomla! Intern
Posts: 53
Joined: Sat Mar 06, 2010 8:21 pm
Contact:

Re: Front page images (jQuery) not working when language fil

Post by electrocity » Tue Oct 11, 2011 1:13 pm

The bug is only with sef route on + language filters
Free and paid Joomla & virtuemart extensions https://shop.st42.fr/en

User avatar
infograf768
Joomla! Master
Joomla! Master
Posts: 19133
Joined: Fri Aug 12, 2005 3:47 pm
Location: **Translation Matters**

Re: Front page images (jQuery) not working when language fil

Post by infograf768 » Wed Oct 12, 2011 10:13 am

Please post the issue (and if possible some patch) on the tracker.
Jean-Marie Simonet / infograf
---------------------------------
ex-Joomla Translation Coordination Team • ex-Joomla! Production Working Group


Locked

Return to “Language - Joomla! 2.5”