Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length

JoomlaTune Support Forum    Other extensions    Modules    Topic: Sample of using mouseover script in latest comments
Pages: [1]   Go Down
  Print  
Author Topic: Sample of using mouseover script in latest comments  (Read 3110 times)
0 Members and 1 Guest are viewing this topic.
Pihas
Newbie
*

Karma: 0
Offline Offline

Posts: 5


Email
« on: February 21, 2010, 17:01:52 »

I made in my website one simple modification of using MouseOver javascript. Then your mouse is over a link of commented article it shows comment:


The source code which i used: http://snipplr.com/view/3624/show-floating-div-near-cursor-on-mouseover-hide-on-mouseout/

That is code in my module:
//After this line: echo '<a class="jcl_objtitle" href="'.$link.'#comment-'.$row->id.'" title="'.$title.'">'.$title.'</a><br />';
//Javacript "header"

Code:
echo '<script type="text/javascript" language="JavaScript">
<!-- Copyright 2006,2007 Bontrager Connection, LLC
// http://bontragerconnection.com/ and http://willmaster.com/
// Version: July 28, 2007
var cX = 0; var cY = 0; var rX = 0; var rY = 0;
function UpdateCursorPosition(e){ cX = e.pageX; cY = e.pageY;}
function UpdateCursorPositionDocAll(e){ cX = event.clientX; cY = event.clientY;}
if(document.all) { document.onmousemove = UpdateCursorPositionDocAll; }
else { document.onmousemove = UpdateCursorPosition; }
function AssignPosition(d) {
if(self.pageYOffset) {
rX = self.pageXOffset;
rY = self.pageYOffset;
}
else if(document.documentElement && document.documentElement.scrollTop) {
rX = document.documentElement.scrollLeft;
rY = document.documentElement.scrollTop;
}
else if(document.body) {
rX = document.body.scrollLeft;
rY = document.body.scrollTop;
}
if(document.all) {
cX += rX;
cY += rY;
}
d.style.left = (cX+10) + "px";
d.style.top = (cY+10) + "px";
}
function HideContent(d) {
if(d.length < 1) { return; }
document.getElementById(d).style.display = "none";
}
function ShowContent(d) {
if(d.length < 1) { return; }
var dd = document.getElementById(d);
AssignPosition(dd);
dd.style.display = "block";
}
function ReverseContentDisplay(d) {
if(d.length < 1) { return; }
var dd = document.getElementById(d);
AssignPosition(dd);
if(dd.style.display == "none") { dd.style.display = "block"; }
else { dd.style.display = "none"; }
}
//-->
</script>';

//Formating link of article title (komentaro_id means comment_id - in Lithuanian  Wink):

Code:
if ($komentaro_id == ''){$komentaro_id = '0';}
$komentaro_id = $komentaro_id + 1;
echo "<a
   onClick=\"parent.location='".$link."'\";
   onmouseover=\"ShowContent('uniquename".$komentaro_id."'); return true; \"
   onmouseout=\"HideContent('uniquename".$komentaro_id."'); return true;\"
   href=\"javascript:ShowContent('uniquename".$komentaro_id."')\">
".$title."
</a>
";
}

//Formating comment text on mouse over the article title link:

Code:
switch( $show_comment_text ) {
case 0:
echo "<div
   id=\"uniquename".$komentaro_id."\"
   style=\"display:none;
position:absolute;
border-style:solid;
background-color: white;
padding: 5px;\">
".$link_text."
</div>";

break;


Would be cool if someone add this to project it is really useful because it saves place of toolbars


* web_mouse_over_show.png (36.79 KB, 300x300 - viewed 502 times.)
« Last Edit: February 21, 2010, 17:06:49 by Pihas » Logged
Pages: [1]   Go Up
  Print  
JoomlaTune Support Forum    Other extensions    Modules    Topic: Sample of using mouseover script in latest comments
 
Jump to: