X-Cart: shopping cart software

X-Cart forums (https://forum.x-cart.com/index.php)
-   Changing design (https://forum.x-cart.com/forumdisplay.php?f=51)
-   -   Javascript Tooltip Problem (https://forum.x-cart.com/showthread.php?t=46723)

SamsonWebDesign 04-02-2009 08:52 AM

Javascript Tooltip Problem
 
I want a tooltip for my site but have a real problem getting the javascript to work.

I've followed the instructions to the letter and nothing seems to get this script working.
Here is the tooltip script I'm looking to use.
http://www.walterzorn.com/tooltip/tooltip_e.htm

Here are the instructions for implementing the script which are pretty easy!
1. Link wz_tooltip.js into the html file
Copy the following line to inside the BODY section, preferably immediately after the opening <body> tag:
<script type="text/javascript" src="wz_tooltip.js"></script> If necessary, adapt the path 'src="wz_tooltip.js"' to the JavaScript file. Note: Use the downloaded file only, do not hardlink wz_tooltip.js from my site.

2. Specify tooltip text inside onmouseover eventhandlers

Each of the html tags to display a tooltip requires an onmouseover and an onmouseout attribute like so:
Including the script at the beginning of the body section ensures that the tooltips are almost immediately functional, before loading the page has been finished. <a href="index.htm" onmouseover="Tip('Some text')" onmouseout="UnTip()">Homepage</a> That's all. No title attributes, no container DIV. As you can see, the text to be displayed must be enclosed with single quotes, and be passed to a function Tip().

I've uploaded the javascript files and am calling them from the /customer/home.tpl as follows:
PHP Code:

{literal}<script type="text/javascript" src="{$SkinDir}/modules/wz_tooltip/wz_tooltip.js"></script>{/literal


Then implemented the call to mouseover for the tooltip on the link as follows:
PHP Code:

<a href="product.php?productid={$products[product].productid}&cat={$cat}&page={$navigation_page}{if $featured eq 'Y'}&featured{/if}" onmouseover="Tip('Some text')" onmouseout="UnTip()"><font class="ProductTitle">{$products[product].product}</font></a


I've tried the javascript before the </head> tag and after the <body> tag and nothing seems to make this work.

Anyone got any ideas!!!!!

Victor D 04-03-2009 12:30 AM

Re: Javascript Tooltip Problem
 
As you wrap code with {literal} {$SkinDir} variable won't be replaced with its content.
So remove literal - it is not required in your case.
External js file linked with script tag is not parsed by Smarty.
I believe that you placed this script in skin1/modules/wz_tooltip/

SamsonWebDesign 04-03-2009 04:29 AM

Re: Javascript Tooltip Problem
 
Quote:

Originally Posted by Victor D
As you wrap code with {literal} {$SkinDir} variable won't be replaced with its content.
So remove literal - it is not required in your case.
External js file linked with script tag is not parsed by Smarty.
I believe that you placed this script in skin1/modules/wz_tooltip/


Awesone. That works fine now. I knew it would be something simple but couldn't see the wood for the trees! :roll:

Thanks.

rct 10-07-2009 10:07 AM

Re: Javascript Tooltip Problem
 
I am using the same script, however I am putting it in the embedded static page. It is not working if I put the script in skin1/modules/Tooltips/wz_tooltip (see the code below) , but it will work fine if I have all the codes in the page content ... meaning - a big long inefficient way of coding.

Any advice? Thanks

************************************************** *******
code:

<body>{literal}

<script type="text/javascript" src="http://www.reallycooltees.com/public_html/modules/Tooltips/wz_tooltip.js" >
</script>
{/literal}

<a href=" " onmouseout="UnTip()" onmouseover="Tip('Why do we charge your art fees?')" >$30.0/hour</a>
</body>

Victor D 10-08-2009 02:46 AM

Re: Javascript Tooltip Problem
 

Should be something like this
Code:

/skin1/modules/Tooltips/wz_tooltip.js

rct 10-08-2009 06:20 AM

Re: Javascript Tooltip Problem
 
thanks Vic, for the advice, tried, still not working, however found a similar, but not as fancy.

Victor D 10-08-2009 06:31 AM

Re: Javascript Tooltip Problem
 
Is this file located in the directory public_html/skin1/modules/Tooltips/ on your server currently?

not in public_html/modules/Tooltips/ - this directory is not accesible from the web.

rct 10-08-2009 05:46 PM

Re: Javascript Tooltip Problem
 
You are correct, that's the problem , I put it in the inaccessible directory! Thanks so much for helping!


All times are GMT -8. The time now is 06:00 PM.

Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.