[DYNIFS] Firefox 1.5 and anchor [solved]
 
 
Post new topic   Reply to topic   printer-friendly view    phpMiX.org Forum Index -> Widgets Discussion -> Javascript Snippets
View previous topic :: View next topic  
Author Message
RemyRoy
Starter
Starter


Joined: 05 Jul 2006
Posts: 3

PostPosted: Wed Jul 05, 2006 4:58 pm    Post subject: [DYNIFS] Firefox 1.5 and anchor [solved] Reply with quote

Hello,

I have a problem with DYNIFS and Firefox 1.5. My IFrame is a forum that is something using anchors (#blahblah at the end of the url) to position the user at a certain place (to a certain post for example). My hosting page is in the same domain as my forum.

My hosting page is located at: http://www.example.com/forum.aspx. The iframe is located at: http://www.example.com/forum/framehelper.aspx. When the iframe points to a url that contains an anchor, the iframe is correctly resized but the upper part of it is missing. It's working perfectly with IE 6. It's hard to explain in word so here is a picture to help figure it out.

http://img210.imageshack.us/img210/61/dynifsanchor3jq.png

Since I've added scrolling="no", there is no way to see the upper part of the iframe.

Anyone has been experiencing the same problem? Is there a way to solve it?

Thanks



dynifsanchor3jq.png
 Description:
Picture attached by admin, so it doesn't get lost.
It's a perfect example of "an image is better than 1000 words". ;)
 Filesize:  10.93 KB
 Viewed:  20360 Time(s)

dynifsanchor3jq.png


 
Back to top
View user's profile Send private message
markus
[Administrator]
[Administrator]


Joined: 28 Jul 2003
Posts: 1124

PostPosted: Wed Jul 05, 2006 7:42 pm    Post subject: Reply with quote

hmm.... interesting.

Try this:

OPEN: dynifs.js

FIND:
Code:
      div.style.height = (dim[1]+30) + 'px';

AFTER, ADD:
Code:
if (window.pageYOffset && iframe.pageYOffset &&   // Y scroll pos in FF
   iframe.pageYOffset > 0 &&                      // Y scroll pos is not on top
   window.frames[id].location.hash.length > 0) {  // Hash in IFrame?

   // Save scroll positions for both, main and IFramed docs
   var wy = window.pageYOffset;
   var fy = iframe.pageYOffset;

   // Move IFramed doc to top
   iframe.scroll(0,0);

   // Reset main doc position.
   window.scroll(0,wy+fy);
}

IE6 won't run that code (it doesn't support pageYOffset). That may work for Firefox 1.5, but I'm not sure if it may affect Opera or IE7.

 
 
_________________
http://www.phpmix.org
 
Back to top
View user's profile Send private message
RemyRoy
Starter
Starter


Joined: 05 Jul 2006
Posts: 3

PostPosted: Wed Jul 05, 2006 8:36 pm    Post subject: Reply with quote

It works. Thanks for the quick reply.  
Back to top
View user's profile Send private message
RemyRoy
Starter
Starter


Joined: 05 Jul 2006
Posts: 3

PostPosted: Wed Jul 05, 2006 9:11 pm    Post subject: Reply with quote

I did a little fix. It seems like 0 && something returns false and if my window.pageYOffset is 0, it doesn't work.

Here is my new code.

Code:
if (iframe.pageYOffset && (window.pageYOffset || window.pageYOffset == 0) &&   // Y scroll pos in FF
   iframe.pageYOffset > 0 &&                      // Y scroll pos is not on top
   window.frames[id].location.hash.length > 0) {  // Hash in IFrame?

   // Save scroll positions for both, main and IFramed docs
   var wy = window.pageYOffset;
   var fy = iframe.pageYOffset;

   // Move IFramed doc to top
   iframe.scroll(0,0);

   // Reset main doc position.
   window.scroll(0,wy+fy);
}
 
Back to top
View user's profile Send private message
markus
[Administrator]
[Administrator]


Joined: 28 Jul 2003
Posts: 1124

PostPosted: Thu Jul 06, 2006 6:46 am    Post subject: Reply with quote

The purpose of the first 2 conditions was to check if pageYOffset is supported, so the following would do it too:

Code:
if (typeof window.pageYOffset == 'number' &&      // is pageYOffset supported?
   typeof iframe.pageYOffset == 'number' &&
   iframe.pageYOffset > 0 &&                      // Y scroll pos is not on top
   window.frames[id].location.hash.length > 0) {  // Hash in IFrame?

   // Save scroll positions for both, main and IFramed docs
   var wy = window.pageYOffset;
   var fy = iframe.pageYOffset;

   // Move IFramed doc to top
   iframe.scroll(0,0);

   // Reset main doc position.
   window.scroll(0,wy+fy);
}

 
 
_________________
http://www.phpmix.org
 
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    phpMiX.org Forum Index -> Widgets Discussion -> Javascript Snippets All times are GMT + 1 Hour
 
Page 1 of 1


 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum