jQuery select element
Posted: Sun Sep 20, 2009 8:17 am
Hello all
I have made some jquery code :
To serve this php code :
As u c, after clicking on $('div.data a') the load functions is fired, but there was a mistake , cause on the page there are fiew anchors elements close each other, and when moving mouse over one before another load finished, the whole page starts blinking.
So I decided to made interval and I made this code :
U can see here the setTimeout function set to 1000ms. But now the problem is that the [data] parameter, which is second load() function parameter don't gather the 'rel' and 'value' values corectly.
I think because of $(this), which no longer referes to $('div.data a').
I was trying to refere to this values in some other way but without good results,
Enybody can help ?
I have made some jquery code :
Code: Select all
$("div.data a").live("mouseover",function(){ $('#foto').load('gallery.php', { 'dir':$(this).parent('div.data').attr('rel'), 'kategory':$(this).parent('div.data').attr('value'), 'gallery':'no'}, function() { $(this).hide().fadeIn('slow'); }); $move_by = 600; $frame_left = 0; $frame_no = 1; return false; }); Code: Select all
if(isset($_POST['kategory'])) {
$rows = $data->retrieveData($_POST['kategory']);
//print_r($rows[0]['title']);
$count = count($rows);
}
for($i = 0; $i < $count; $i++) {
echo '<div id="data" class="data" rel="'.$rows[$i]['dir'].'" value="'.$rows[$i]['kategory'].'"><a href="#">'.$rows[$i]['date'].' : '.$rows[$i]['title'].' - '.$rows[$i]['text'].'</a></div>';
}
So I decided to made interval and I made this code :
Code: Select all
$("div.data a").live("mouseover",function(){ setTimeout(function() { $('#foto').load('gallery.php', { 'dir':$(this).parent('div.data').attr('rel'), 'kategory':$(this).parent('div.data').attr('value'), 'gallery':'no'}, function() { $(this).hide().fadeIn('slow'); }); $move_by = 600; $frame_left = 0; $frame_no = 1; return false; }, 1000); }); Code: Select all
'dir':$(this).parent('div.data').attr('rel'),'kategory':$(this).parent('div.data').attr('value'), I was trying to refere to this values in some other way but without good results,
Enybody can help ?