Support Forum Project Downloads FAQ Documentation About Demo Tutorials Blog Plugins
February 09, 2010, 08:07:16 am *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
News: cpg1.5.2 beta released
The brand new cpg1.5.x series that comes with a lot of new features finally has reached the release stage: a first public beta release cpg1.5.2 has been released that is mainly aimed at translators, testers and community members that have contributed in the past. The beta release is not meant to be used in a production environment, but only on testbeds and for evaluation purposes. There is currently no support for cpg1.5.x yet!
[more]
   Home   Help Search Board rules Login Register  
Pages: [1] 2   Go Down
  Print  
Author Topic: Image Viewer  (Read 17739 times)
0 Members and 1 Guest are viewing this topic.
rvblog Topic starter
Coppermine regular visitor
**
Posts: 62


« on: January 25, 2005, 09:33:42 am »

I've modified the hardwired theme to look like my website.

This is my problem:

When viewing images in the large image viewer (at smaller screen resolutions), my visitors have to scroll down the page a little bit to see the entire image displayed.

When they click on the next button (top right of the viewer), the viewer displays the next image, but the page is repositioned back to the top of the page, and the visitor has to scroll down a little bit once again to view the entire display.

Is there a way to add code somewhere that would keep the page at the "scrolled down position" as the visitor moves from image to image without them having to use the scroll bar each and every time ?

See here: http://www.rvadventure.ca/photos/displayimage.php?album=5&pos=1

Thanks
Logged
TranzNDance
Dev Team member
****
Gender: Female
United States United States

Posts: 6145



WWW
« Reply #1 on: January 25, 2005, 09:41:55 am »

I guess there could be an anchor placed at the top of the image box, and then add the anchor name to the next/prev links...
Logged

TranzNDance
Dev Team member
****
Gender: Female
United States United States

Posts: 6145



WWW
« Reply #2 on: January 25, 2005, 10:01:31 am »

OK, here's how to do it.

Open up the theme.php file of the theme you want to use. (code has been corrected to work in IE)

FIND:
Code:
$template_img_navbar = <<<EOT

AFTER it, FIND the first:
Code:
<td align="center" valign="middle" class="navmenu" width="48">

REPLACE with:
Code:
<a name="top_imageviewer"><td align="center" valign="middle" class="navmenu" width="48"></a>
========


FIND:
Code:
href="{PREV_TGT}"

REPLACE with:
Code:
href="{PREV_TGT}#top_imageviewer"
========

FIND:
Code:
href="{NEXT_TGT}"

REPLACE with:
Code:
href="{NEXT_TGT}#top_imageviewer"
========

It works quite nicely, if I do say so myself. Wink
« Last Edit: January 26, 2005, 12:03:53 am by TranzNDance » Logged

rvblog Topic starter
Coppermine regular visitor
**
Posts: 62


« Reply #3 on: January 25, 2005, 03:13:26 pm »

Thanks,

That is EXACTLY what i wanted - it works great

I did make a small change to your example and placed
Code:
<a name="top_image" id="top_imageviewer"></a>
after
Code:
$template_main_menu1 = <<<EOT
instead, so that my navbar always stays in view and appears at the top after each click

Have a look and see.

Also, I may be able to use this technique for other little adjustments as well - this will certainly be added to my little bag of tricks

I appreciate the help.
Logged
Casper
VIP
***
Gender: Male
Posts: 5232



WWW
« Reply #4 on: January 25, 2005, 05:18:32 pm »

I think this is an excellent little hack, and would be appreciated by many users.
Logged

I provide support for coppermine here, nowhere else. If you pm or email me, without first asking, the message will go directly to the bin, without being answered.
www.hsocuk.com/galleries/
TranzNDance
Dev Team member
****
Gender: Female
United States United States

Posts: 6145



WWW
« Reply #5 on: January 25, 2005, 06:14:58 pm »

argh... this doesn't seem to work in IE. WTH?! %$*&! @IE

I didn't test in IE before (but it was 2am my time when I worked on this). It's the same in both of our galleries, rvblog.
Logged

rvblog Topic starter
Coppermine regular visitor
**
Posts: 62


« Reply #6 on: January 25, 2005, 07:15:59 pm »

@TranzNDance

ok, I played around with it a bit and I believe that this is the IE fix:

Code:
[b]<a name="topimage"></a>[/b]

Code:
[b]href="{PREV_TGT}#topimage"[/b]

Code:
[b]href="{NEXT_TGT}#topimage"[/b]

I remembered another issue I worked on last year where IE did not like names that had more than one word.

IE seems to work ok with #topimage but not #top_image


I removed the reference to "id="topimageviewer" because it looks like that would only be needed if you had to style it for some reason.
Logged
kegobeer
Dev Team member
****
Gender: Male
Posts: 4637


Beer - it does a body good!


WWW
« Reply #7 on: January 25, 2005, 07:19:34 pm »

If you use id and name in the same link, they need to be the same.
Logged

Do not send me a private message unless I ask for one.  Make your post public so everyone can benefit.

There are no stupid questions
But there are a LOT of inquisitive idiots
rvblog Topic starter
Coppermine regular visitor
**
Posts: 62


« Reply #8 on: January 25, 2005, 07:54:29 pm »

@TranzNDance:

I also noticed that in my album example - where there are 6 images - this code fix works for images 2 to 6 because the code fix is tied into the prev and next buttons

The first image in the image viewer still had to be scrolled.

So I backed up through the same thought process and added #topimage to the other code (in 2 places further down in the theme file) like this and it worked:

Code:
'{LINK_TGT}' => "displayimage.php?album=$aid$cat_link&pos={$thumb['pos']}#topimage",

Now, when viewing the album list screen, when you click on any thumbnail, the image viewer in the next screen is positioned at the top like the other examples - so now, no scrolling at all is required.



Gee, this is scary - I actually sound like I know what I'm talking about.  LOL

Logged
TranzNDance
Dev Team member
****
Gender: Female
United States United States

Posts: 6145



WWW
« Reply #9 on: January 25, 2005, 10:16:36 pm »

If you use id and name in the same link, they need to be the same.
Doh! I'm a doofus (still, it was 2am Grin). I forgot to rename everything.

It still didn't work, though. I tried the other suggestions, too.

What seems to be the problem is that IE doesn't like the empty <a> tags. So I put the tags around the first <td> and it now works. Works in Opera, too. Smiley
« Last Edit: January 25, 2005, 10:32:13 pm by TranzNDance » Logged

TranzNDance
Dev Team member
****
Gender: Female
United States United States

Posts: 6145



WWW
« Reply #10 on: January 25, 2005, 10:28:14 pm »

Gee, this is scary - I actually sound like I know what I'm talking about. LOL
Good for you Smiley. It was Nibbler's idea for me to help out in the forums and I didn't think I could do it but here we are.
Logged

dondo521
Coppermine novice
*
Posts: 24


« Reply #11 on: January 25, 2005, 11:59:35 pm »

This looks awesome, wish I thought of something like this...!
Is it possible you could post the code entirely and where everything should go(what files to change...etc)?

Great job!
dondo521
Logged
TranzNDance
Dev Team member
****
Gender: Female
United States United States

Posts: 6145



WWW
« Reply #12 on: January 26, 2005, 12:02:37 am »

I did say which file to change. I only posted the parts of the file that was necessary to change instead of a completed file since people don't always have default, unmodded files.
Logged

rvblog Topic starter
Coppermine regular visitor
**
Posts: 62


« Reply #13 on: January 26, 2005, 12:41:57 am »

@dondo521

Once TranzNDance told me about the "#whatevername" code, it's just a matter of playing around with it a bit - you just add it after the tag that affects the area that you want to position.

In my example (I started with the hardwired theme):

I added this code:

Code:
<a name="topimage"></a>
after this tag:
Code:
$template_main_menu1 = <<<EOT

And then I changed these tags:

Code:
<a href="{SLIDESHOW_TGT}#topimage" title="{SLIDESHOW_TITLE}"><img src="themes/hardwired/images/slideshow.gif" width="21" height="15" border="0" align="absmiddle" alt="{SLIDESHOW_TITLE}" /></a>

Quote
<a href="{PREV_TGT}#topimage" class="navmenu_pic" title="{PREV_TITLE}"><img src="themes/hardwired/images/previmg.gif" width="18" height="15" border="0" align="absmiddle" alt="{PREV_TITLE}" /></a>

Code:
<a href="{NEXT_TGT}#topimage" class="navmenu_pic" title="{NEXT_TITLE}"><img src="themes/hardwired/images/nextimg.gif" width="18" height="15" border="0" align="absmiddle" alt="{NEXT_TITLE}" /></a>

Code:
'{LINK_TGT}' => "displayimage.php?album=$aid$cat_link&pos={$thumb['pos']}#topimage",

Just use the search feature in your php editor to find the appropriate tags in whatever theme you are using and from there.

Logged
TranzNDance
Dev Team member
****
Gender: Female
United States United States

Posts: 6145



WWW
« Reply #14 on: January 26, 2005, 01:11:59 am »

@rvblog, the anchor isn't working on your site in IE due to there being nothing between the <a> tags... just in case you have visitors using IE still. Wink
Logged

kegobeer
Dev Team member
****
Gender: Male
Posts: 4637


Beer - it does a body good!


WWW
« Reply #15 on: January 26, 2005, 01:24:04 am »

[offtopic]
@rvblog: I get a javascript syntax error when I view your site with IE.

Line: 20
Char: 1
Error: Syntax Error
Code: 0
[/offtopic]

@all: From the W3C:
Quote
User agents should be able to find anchors created by empty A elements, but some fail to do so.
Logged

Do not send me a private message unless I ask for one.  Make your post public so everyone can benefit.

There are no stupid questions
But there are a LOT of inquisitive idiots
rvblog Topic starter
Coppermine regular visitor
**
Posts: 62


« Reply #16 on: January 26, 2005, 03:15:01 am »

@TranzNDance:

Everything seemed to work ok on my end when I used IE - but I moved the code anyways - like this:

(note: the name=#topimage was added to the <a> tag about half way down in the code example)

Code:
$template_main_menu2 = <<<EOT
                <span class="topmenu">
                        <table border="0" cellpadding="0" cellspacing="0">
                                <tr>
<!-- BEGIN album_list -->
<!--
         <td><img name="spacer" src="images/spacer.gif" width="5" height="25" border="0" id="spacer" alt="" /></td>
         <td><img name="buttonleft1" src="themes/ardwired/images/buttonleft1.gif" width="7" height="25" border="0" id="buttonleft" alt="" /></td>
-->

  <td background="themes/ardwired/images/buttoncenter1.gif"><a href="http://www.rvadventure.ca" title="Return to Home Page">Home</a>
          <a name="topimage" href="{ALB_LIST_TGT}" title="{ALB_LIST_TITLE}">{ALB_LIST_LNK}</a>
          </td>
<!--
  <td><img name="buttonright1" src="themes/hardwired/images/buttonright1.gif" width="7" height="25" border="0" id="buttonright1" alt="" /></td>
-->
<!-- END album_list -->


Does that resolve the
Quote
nothing between the <a> tags...
statement that you were talking about ?



@ kegobeer:

I also noticed the error at the bottom left corner of my browser - but had no idea what it meant

And, I don't really understand what it is you are saying in your reply

I went here :

http://validator.w3.org/check?uri=http%3A%2F%2Fwww.rvadventure.ca%2F

and here:

http://jigsaw.w3.org/css-validator/validator?uri=http%3A%2F%2Fwww.rvadventure.ca%2F

and everything validated ok

So what is causing the error and how do I fix it ?? - I know absolutely nothing about javascript.

Thanks

Logged
TranzNDance
Dev Team member
****
Gender: Female
United States United States

Posts: 6145



WWW
« Reply #17 on: January 26, 2005, 03:25:59 am »

@TranzNDance:

Everything seemed to work ok on my end when I used IE - but I moved the code anyways
Works now. I'm using IE6, SP2.
Logged

kegobeer
Dev Team member
****
Gender: Male
Posts: 4637


Beer - it does a body good!


WWW
« Reply #18 on: January 26, 2005, 03:33:23 am »

I don't know if this is related, but if I view source on your page, this is displayed:
<html dir="{lang_dir}">

but it should be this:
<html dir="ltr">

Verify you have this line in your theme.php file, in the pageheader function:
Code:
$template_vars = array('{LANG_DIR}' => $lang_text_dir,
Logged

Do not send me a private message unless I ask for one.  Make your post public so everyone can benefit.

There are no stupid questions
But there are a LOT of inquisitive idiots
dondo521
Coppermine novice
*
Posts: 24


« Reply #19 on: January 26, 2005, 03:50:35 am »

Thanks everyone for all your help...seems to work ok in I.E. but unfortunetly not in Firefox Huh
dondo521

by the way nice looking site TranzNDance-very clean and well thought out... Wink
Logged
Pages: [1] 2   Go Up
  Print  
 
Jump to:  

Powered by SMF 1.1.11 | SMF © 2006-2009, Simple Machines LLC
Page created in 0.118 seconds with 19 queries.