View Single Post
  #6  
Old 10th March 2014, 20:48
mat22 mat22 is offline
Senior Member
 
Join Date: Jun 2009
Latvia
Posts: 119
Default
Ok, so I tried different variations of code but still couldn't get it working.
But I improved code a bit so it now only uses 1 javascript to increase ID every time (and yes, it works fine until last torrent poster on page).

This is the part from movies.php where the actual hover effect is.
Code:
/* Hover funkcija */
?>
<script language="javascript" type="Text/JavaScript">
$('#1').contenthover({
    overlay_background:'#333',
});
</script>
<!-- This increases element id -->
<script language="javascript" type="Text/JavaScript">
var ID = 0;
$('div.cipars').each(function() {
    ID++;
    $(this).attr('id', 'id'+ID);
});
</script>
<!-- id increase end -->
<style>
.contenthover { padding:20px 20px 10px 20px; display:inline-block; max-width:170px; }
.contenthover, .contenthover h3, contenthover a { color:#fff; display:inline-block; max-width:170px; }
.contenthover h3, .contenthover p { margin:0 0 10px 0; padding:0; display:inline-block; max-width:170px; }
.contenthover a.mybutton { display:inline-block; padding:0 0; max-width:170px; background:#3c9632; color:#fff; -moz-border-radius: 4px; -webkit-border-radius: 4px; border-radius: 4px; }
.contenthover a.mybutton:hover { background:#34742d display:inline-block; max-width:170px; }
</style>
<?
/* Hover funkcija */

print("<td align=\"center\" colspan=\"0\" border=\"0\" width=\"175\"><div align=\"center\" width=\"170\"><hr>
<div width=\"170\"><a href=\"/browse.php?c25=1&c26=1&c24=1&c41=1&c47=1&c23=1&search=$search_name\" title=\"$name\"><b><u>$shortname2</u></b></a>
<br><small><a href=\"/browse.php?c25=1&c26=1&c24=1&c41=1&c47=1&c23=1&search=$search_name\" title=\"$ori_name\"><b><a href=\"#\" title=\"$ori_name\">$shortname</b></a></small>
</div><hr>
<div><div id=\"1\" class=\"cipars\">$poster</div>
<div class=\"contenthover\">
<div id=\"1\" class=\"cipars\"><br>
<a href=\"/browse.php?c25=1&c26=1&c24=1&c41=1&c47=1&c23=1&search=$search_name\"><img src=\"https://cdn1.iconfinder.com/data/icons/VistaICO-File-Icons/256/Video/XVID.png\" width=\"20\"/></a>
</div></div></div>
<hr>
Thing is - first 15 posters (out of 16) work fine and hover effect works just as needed. But the problem is with last one - in page source it shows "id = 1" while for other it's, for example, "id = id29" or "id = id23" or something like that. Looks like last torrent just takes that id from code and I'm not able to figure out how to get it to work correctly. From all other aspects it works perfectly (and yes - I know there are probably better ways to make those id change every time).
Reply With Quote