View Full Version : CMotion IE issue jumping back to first image

01-05-2009, 11:30 PM
1) CMotion Image Gallery

2) http://www.dynamicdrive.com/dynamicindex4/cmotiongallery.htm

3) I just inherited a site that uses C Motion. This is my first time with it. I don't think the issue is with C Motion as much as with the integration.

Here's what happens: At this URL: http://gallerysoftware.com/wirthmore/searchresults.php?categoryarray[]=Fa%EFence and only in IE, if you scroll to the right until you come to a vertically oriented/portrait image that is taller than the rest and click on it the scrolling resets and jumps all the way back to the first image. This doesn't happen if you click on one of the other images that are all the same height.

Any thoughts? Several of us have been banging our heads against this and we're just not getting anywhere.

Thank you.

01-06-2009, 12:16 AM
First of all, and this is probably unrelated, instead of using:

loadobjs('css/style.css', 'css/title.css', 'zoom/zoom.css', 'js/imageswap.js')

over and over, since these resource files are integral to your page's working anyway, why not just include them in the head section of the 'top' page?

Now the trouble may be no return value for the onclick event. So you could do (scroll the code block to the right to see the highlighted addition):

<a href="javascript:void(0);" onclick="ajaxpage('title.inc.php?ititlenum=10674', 'middle_title'); loadobjs('css/style.css', 'css/title.css', 'zoom/zoom.css', 'js/imageswap.js');return false;">

Or after my other recommended change (scroll the code block to the right to see the highlighted addition):

<a href="javascript:void(0);" onclick="ajaxpage('title.inc.php?ititlenum=10674', 'middle_title');return false;[/ICODE]">

I say may because a simple local test will not suffice in determining the efficacy of this solution where AJAX is involved. In other words, there could also still be other problems.

01-06-2009, 08:07 AM
I was playing around with your page a bit more and realized that, though my previous advice is good, it won't solve the problem. What's happening is that when you load those 'portrait' images into the AJAX receiving division:

<div id="middle_title">
</div> <!-- end middle_title -->

It makes it get just a pixel or so taller than do the 'landscape' images. This changes the page's height, which triggers the cmotion gallery's resize function, which recalculates the gallery's dimensions and restarts the gallery at the beginning.

You will also notice that the same problem occurs loading a 'landscape' image right after a 'portrait' one. This time because the page is getting shorter.

To avoid that, you just have to make sure that the size of the page only changes if the user changes it by resizing their window. One way would be to set the receiving division to a height that can accommodate the taller image, ex:

<div id="middle_title" style="height:700px;">
</div> <!-- end middle_title -->

01-06-2009, 03:43 PM
Thank you for taking the time to look at that. I think it's great that you are willing to help people out here.

I figured it had to have something to do with the height but I was focusing on the height of the scrolling section. I think the advice in both of your posts is spot on. I'll give it a try and let you know, but I fully expect it to fix the problem.

Thank you again. I really appreciate your help.

01-06-2009, 05:37 PM
Adding the height totally took care of the issue.
Thanks again, John!