View previous topic :: View next topic |
Author |
Message |
hassan68 Smarty Rookie
Joined: 27 Apr 2011 Posts: 21
|
Posted: Sun Mar 18, 2012 4:57 pm Post subject: smarty tooltip |
|
|
i want to use a tooltip for my site
and i have some javascript code
Code: |
{literal}
<script type="text/javascript">
<!--
$(function () {
$('.bubbleInfo').each(function () {
var distance = 10;
var time = 250;
var hideDelay = 500;
var hideDelayTimer = null;
var beingShown = false;
var shown = false;
var trigger = $('.trigger', this);
var info = $('.popup', this).css('opacity', 0);
$([trigger.get(0), info.get(0)]).mouseover(function () {
if (hideDelayTimer) clearTimeout(hideDelayTimer);
if (beingShown || shown) {
// don't trigger the animation again
return;
} else {
// reset position of info box
beingShown = true;
info.css({
top: -90,
left: -33,
display: 'block'
}).animate({
top: '-=' + distance + 'px',
opacity: 1
}, time, 'swing', function() {
beingShown = false;
shown = true;
});
}
return false;
}).mouseout(function () {
if (hideDelayTimer) clearTimeout(hideDelayTimer);
hideDelayTimer = setTimeout(function () {
hideDelayTimer = null;
info.animate({
top: '-=' + distance + 'px',
opacity: 0
}, time, 'swing', function () {
shown = false;
info.css('display', 'none');
});
}, hideDelay);
return false;
});
});
});
//-->
</script>
{/literal}
|
and a javascript file that used in head of site
<script src="demo/jquery.js" type="text/javascript"></script>
but when i reload my site to chek work this tooltip or no
i dont have it
and no tooltip show
where is my problem?????? |
|
Back to top |
|
hassan68 Smarty Rookie
Joined: 27 Apr 2011 Posts: 21
|
Posted: Mon Mar 19, 2012 6:26 am Post subject: |
|
|
no one here
no replay
no support |
|
Back to top |
|
douglassdavis Smarty Junkie
Joined: 21 Jan 2008 Posts: 541
|
Posted: Mon Mar 19, 2012 12:52 pm Post subject: |
|
|
Looks more like a javascript problem than a smarty problem.
If you view the source from your browser are you getting the expected html and javascript code? |
|
Back to top |
|
hassan68 Smarty Rookie
Joined: 27 Apr 2011 Posts: 21
|
Posted: Mon Mar 19, 2012 5:12 pm Post subject: |
|
|
yes
do you have any code or plugin for link tooltip for smarty? |
|
Back to top |
|
mohrt Administrator
Joined: 16 Apr 2003 Posts: 7368 Location: Lincoln Nebraska, USA
|
Posted: Mon Mar 19, 2012 5:59 pm Post subject: |
|
|
hassan68 wrote: | yes
do you have any code or plugin for link tooltip for smarty? |
Just use any javascript tooltip program, and put it in your Smarty template. Check your browser source and javascript console for errors. |
|
Back to top |
|
hassan68 Smarty Rookie
Joined: 27 Apr 2011 Posts: 21
|
Posted: Tue Mar 20, 2012 11:28 am Post subject: |
|
|
i used it too but this source too not worked
in head
Code: |
<script src="javascript/jquery.tools.min.js"></script>
{literal}
<script>
$(document).ready(function() {
$("#download_now").tooltip({ effect: 'slide'});
});
</script>
{/literal}
|
and in body
Code: |
<a id="download_now">Download now</a>
<!-- tooltip element -->
<div class="tooltip">
<img src="http://jquerytools.org/media/img/title/eye.png" alt="Flying screens"
style="float:left; margin:0 15px 20px 0" />
<table style="margin:0">
<tr>
<td class="label">File</td>
<td>flowplayer-3.2.7.zip</td>
</tr>
<tr>
<td class="label">Version</td>
<td>2011-03-03</td>
</tr>
<tr>
<td class="label">Size</td>
<td>112 kB</td>
</tr>
<tr>
<td class="label">OS</td>
<td>all</td>
</tr>
</table>
<a href="/release-notes">What's new in 3.2</a>
</div>
|
demo off tooltip
http://jquerytools.org/demos/tooltip/any-html.htm
i think js file not work
but why i dont know
|
|
Back to top |
|
mohrt Administrator
Joined: 16 Apr 2003 Posts: 7368 Location: Lincoln Nebraska, USA
|
Posted: Tue Mar 20, 2012 3:49 pm Post subject: |
|
|
Try this to be certain you get the library loaded:
Code: | <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script> |
And of course, check the javascript console for errors. |
|
Back to top |
|
hassan68 Smarty Rookie
Joined: 27 Apr 2011 Posts: 21
|
|
Back to top |
|
hassan68 Smarty Rookie
Joined: 27 Apr 2011 Posts: 21
|
Posted: Wed Mar 21, 2012 5:18 pm Post subject: |
|
|
problem solved
now
i want too use this js code for more than one div
Code: |
{literal}
<script>
$(document).ready(function() {
$("#download_now").tooltip({ effect: 'slide'});
});
</script>
{/literal}
|
this code is for just one div |
|
Back to top |
|
mohrt Administrator
Joined: 16 Apr 2003 Posts: 7368 Location: Lincoln Nebraska, USA
|
Posted: Wed Mar 21, 2012 7:40 pm Post subject: |
|
|
that is a javascript question, but you need to create a real function (not anonymous) that passes the name of the div as a parameter. |
|
Back to top |
|
dough boy Smarty Rookie
Joined: 31 Mar 2006 Posts: 32
|
Posted: Fri Mar 30, 2012 12:55 am Post subject: |
|
|
Read up on your jQuery selectors
Code: | $(function () {
$('#div1,#div2').tooltip({ effect: 'slide'});
}); |
or
Code: | $(function () {
$('div').each(function () {
$(this).tooltip({ effect: 'slide'});
})
}); |
|
|
Back to top |
|
|