wolfe
12-21-2007, 06:08 PM
hi i am currently trying to make it load an image in a box when i mouse over a thread title in forumdisplay
threadbit_display (plugin)
$images = $db->query("
SELECT img FROM " . TABLE_PREFIX . "post
WHERE threadid = $thread[threadid]
");
while ($image = $db->fetch_array($images))
{
$image_url = $image['img'];
}
in forumdiplay template
<script type="text/javascript" src="clientscript/preimage.js"></script>code in preimage.js
// JavaScript Document
function findPosX(obj)
{
var curleft = 0;
if (obj.offsetParent)
{
while (obj.offsetParent)
{
curleft += obj.offsetLeft
obj = obj.offsetParent;
}
}
else if (obj.x)
curleft += obj.x;
return curleft;
}
function findPosY(obj)
{
var curtop = 0;
if (obj.offsetParent)
{
while (obj.offsetParent)
{
curtop += obj.offsetTop
obj = obj.offsetParent;
}
}
else if (obj.y)
curtop += obj.y;
return curtop;
}
function showimage(obj)
{
var newX = findPosX(obj);
var newY = findPosY(obj);
var x = new fetch_object('imagediv');
x.style.top = newY + 30 + 'px';
x.style.left = newX + 'px';
fetch_object('imagediv').innerHTML = '<img src="$image_url" alt="" height="150" />';
fetch_object('imagediv').style.display = '';
}
function kill_showimage()
{
fetch_object('imagediv').style.display = 'none';
}
and in threadbit template i have this code for the thread title
<div><a href="showthread.php?$session[sessionurl]t=$thread[threadid]$thread[highlight]" id="thread_title_$thread[realthreadid]" onmouseover="showimage($image_url);" onmouseout="kill_showimage();"<if condition="$show['gotonewpost']"> style="font-weight:bold"</if>>$thread[threadtitle]</a></div>
i am trying to make it smiler to the profile preview on mouse over
threadbit_display (plugin)
$images = $db->query("
SELECT img FROM " . TABLE_PREFIX . "post
WHERE threadid = $thread[threadid]
");
while ($image = $db->fetch_array($images))
{
$image_url = $image['img'];
}
in forumdiplay template
<script type="text/javascript" src="clientscript/preimage.js"></script>code in preimage.js
// JavaScript Document
function findPosX(obj)
{
var curleft = 0;
if (obj.offsetParent)
{
while (obj.offsetParent)
{
curleft += obj.offsetLeft
obj = obj.offsetParent;
}
}
else if (obj.x)
curleft += obj.x;
return curleft;
}
function findPosY(obj)
{
var curtop = 0;
if (obj.offsetParent)
{
while (obj.offsetParent)
{
curtop += obj.offsetTop
obj = obj.offsetParent;
}
}
else if (obj.y)
curtop += obj.y;
return curtop;
}
function showimage(obj)
{
var newX = findPosX(obj);
var newY = findPosY(obj);
var x = new fetch_object('imagediv');
x.style.top = newY + 30 + 'px';
x.style.left = newX + 'px';
fetch_object('imagediv').innerHTML = '<img src="$image_url" alt="" height="150" />';
fetch_object('imagediv').style.display = '';
}
function kill_showimage()
{
fetch_object('imagediv').style.display = 'none';
}
and in threadbit template i have this code for the thread title
<div><a href="showthread.php?$session[sessionurl]t=$thread[threadid]$thread[highlight]" id="thread_title_$thread[realthreadid]" onmouseover="showimage($image_url);" onmouseout="kill_showimage();"<if condition="$show['gotonewpost']"> style="font-weight:bold"</if>>$thread[threadtitle]</a></div>
i am trying to make it smiler to the profile preview on mouse over