vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   (Ajax) Image On Mouse Over (https://vborg.vbsupport.ru/showthread.php?t=165803)

wolfe 12-21-2007 06:08 PM

(Ajax) Image On Mouse Over
 
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)
PHP Code:

$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

HTML Code:

<script type="text/javascript" src="clientscript/preimage.js"></script>
code in preimage.js

HTML Code:

// 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

HTML Code:

<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


All times are GMT. The time now is 10:28 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.00920 seconds
  • Memory Usage 1,720KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (3)bbcode_html_printable
  • (1)bbcode_php_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (1)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete