This topic is locked
[SOLVED]

 Auto open/view image

6/30/2011 2:48:09 AM
PHPRunner General questions
L
luck author

Hi,
I have 20 records/images on a table and in the list page I set to show 6 records/images on page. When I click an image it open/view on iframe. How can I do to automaticaly open/view one image from every page. For exemple when I click the second page automaticaly open the first image from that page and so on.
The table is named Images and contain only one field Image. Every page contain selected images and if I click and open an image and than click on the other page I need the image from the iframe to be one of the images from that page not the last image that I opened.
Please help me with that problem.
Thank you in advance !

C
cgphp 6/30/2011

Hi luck,
paste the following code in the Javascript OnLoad event:

$("a[rel='ibox']").eq(0).trigger('click');
L
luck author 6/30/2011



Hi luck,
paste the following code in the Javascript OnLoad event:

$("a[rel='ibox']").eq(0).trigger('click');



Hi cgphp,
Thank you for your quick response, but is not working. Nothing is happening when I open the list page.
Please tell me what I can do to make it work.
Thank you in advance !

C
cgphp 6/30/2011

Have you set iBox option to display images ?

L
luck author 6/30/2011



Have you set iBox option to display images ?


I have set iBox and indeed the image is automaticaly open, but i need to open without using iBox.
Please tell me what to do.
Thank you in advance !

C
cgphp 6/30/2011

Sorry luck. I get confused.
In a php snippet you have an iframe like this:

echo "<iframe name=\"your_frame_name\" id=\"your_frame_id\" src=\"\" ></iframe>";



Right ?
In the javascript OnLoad event paste this code:

var image_path = $("a[rel='ibox'] img").eq(0).attr("src");

$("#your_frame_id").css("width","100px");

$("#your_frame_id").css("height","100px");

$("#your_frame_id").css("background-image","url("+image_path+")");

$("#your_frame_id").css("background-repeat","no-repeat");
L
luck author 6/30/2011



Sorry luck. I get confused.
In a php snippet you have an iframe like this:

echo "<iframe name=\"your_frame_name\" id=\"your_frame_id\" src=\"\" ></iframe>";



Right ?
In the javascript OnLoad event paste this code:

var image_path = $("a[rel='ibox'] img").eq(0).attr("src");

$("#your_frame_id").css("width","100px");

$("#your_frame_id").css("height","100px");

$("#your_frame_id").css("background-image","url("+image_path+")");

$("#your_frame_id").css("background-repeat","no-repeat");



Sorry cgphp. Your first code was what I need, but without using iBox.
When I click an image it is normaly open in a new window. I edited the $value.= " target=_blank"; from listpage.php from classes line 2122 and I changed to open all the images that I click on in the iFrame1 ($value.= " target=_iFrame1"<img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=reply&id=59117&image=1&table=forumreplies' class='bbc_emoticon' alt=';)' />.

Now the problem is that I need in iFrame1 one image from the curent page and not the last image that I open.

And what is doing the first code that you send to me it was perfect, but I want the same thing without iBox.
Can you help me with that please ?
Thank you in advance!

C
cgphp 6/30/2011
$("a[target='_iFrame1'] img").eq(0).trigger('click');
L
luck author 6/30/2011


$("a[target='_iFrame1'] img").eq(0).trigger('click');



Thank you very much ! You are the best.