HTML Logo by World Wide Web Consortium (www.w3.org). Click to learn more about our commitment to accessibility and standards.

Moving forward with Composr

ocPortal has been relaunched as Composr CMS, which is now in beta. ocPortal 9 will be superseded by Composr 10.

Head over to compo.sr for our new site, and to our migration roadmap. Existing ocPortal member accounts have been mirrored.


[RESOLVED] The preview button and scrolling

Login / Search

 [ Join | More ]
 Add topic 
Posted
Rating:
#68295 (In Topic #14521)
Avatar

Community saint

I want to speed-up or eliminate the scrolling that occurs when the preview button is pressed.

Its just a simple matter of tweaking "dist=dir*17" in the smoothScroll function of JAVASCRIPT.tpl.

My question is what, if anything, else uses the smoothScroll function?


Last edit: by temp1024

Do you have a Samsung Galaxy S / Galaxy S II ? If so, why not check out my ScreenFree FM Radio .
Back to the top
 
Posted
Rating:
#68296
Avatar

Lots uses smoothScroll, but you could change it to use window.scrollTo directly. If you make a change it is best to replace the function via putting an override into JAVASCRIPT_CUSTOM_GLOBALS.tpl.


Become a fan of ocPortal on Facebook or add me as a friend. Add me on on Twitter.
Was I helpful?
  • If not, please let us know how we can do better (please try and propose any bigger ideas in such a way that they are fundable and scalable).
  • If so, please let others know about ocPortal whenever you see the opportunity.
  • If my reply is too Vulcan or expressed too much in business-strategy terms, and not particularly personal, I apologise. As a company & project maintainer, time is very limited to me, so usually when I write a reply I try and make it generic advice to all readers. I'm also naturally a joined-up thinker, so I always express my thoughts in combined business and technical terms. I recognise not everyone likes that, don't let my Vulcan-thinking stop you enjoying ocPortal on fun personal projects.
  • If my response can inspire a community tutorial, that's a great way of giving back to the project as a user.
Back to the top
 
Posted
Rating:
#68303
Avatar

Community saint

Thanks, will do.

Do you have a Samsung Galaxy S / Galaxy S II ? If so, why not check out my ScreenFree FM Radio .
Back to the top
 
Posted
Rating:
#70003
Avatar

Community saint

Do the preview buttons actually use smoothScroll?

I ask because I'm using disable_animations and there is no scrolling at all where there should be a single scroll to the top. The code is there thought:

Code

    {+START,IF,{$VALUE_OPTION,disable_animations}}
        window.scrollTo(0,destY);
        return;
    {+END}

but the smoothScroll function does not seem to be called at all.

It works as expected for the OcCLE button.

Do you have a Samsung Galaxy S / Galaxy S II ? If so, why not check out my ScreenFree FM Radio .
Back to the top
 
Posted
Rating:
#70004
Avatar

Just ran a test on Chrome, it did jump down to where the preview was opening, then jumped back up a bit in real terms because the preview didn't use as much space as ocPortal had-preallocated for it for the loading message.


Become a fan of ocPortal on Facebook or add me as a friend. Add me on on Twitter.
Was I helpful?
  • If not, please let us know how we can do better (please try and propose any bigger ideas in such a way that they are fundable and scalable).
  • If so, please let others know about ocPortal whenever you see the opportunity.
  • If my reply is too Vulcan or expressed too much in business-strategy terms, and not particularly personal, I apologise. As a company & project maintainer, time is very limited to me, so usually when I write a reply I try and make it generic advice to all readers. I'm also naturally a joined-up thinker, so I always express my thoughts in combined business and technical terms. I recognise not everyone likes that, don't let my Vulcan-thinking stop you enjoying ocPortal on fun personal projects.
  • If my response can inspire a community tutorial, that's a great way of giving back to the project as a user.
Back to the top
 
Posted
Rating:
#70005
Avatar

Community saint

Here on Firefox 3.6.8 and IE8 its doing nothing for me.

Do you have a Samsung Galaxy S / Galaxy S II ? If so, why not check out my ScreenFree FM Radio .
Back to the top
 
Posted
Rating:
#70060
Avatar

Whoops, flaky testing on my part. Fixed function for JAVASCRIPT.tpl:

Code


function animateFrameLoad(pf,frame,leave_gap_top)
{
   if (!leave_gap_top) leave_gap_top=0;

   {+START,IF,{$NOT,{$VALUE_OPTION,disable_animations}}}
      pf.style.height=window.top.getWindowHeight()+'px'; {$,Enough to stop jumping around}
      var head='<style type="text/css">',cssText='';
      for (var i=0;i<document.styleSheets.length;i++)
      {
         if ((typeof document.styleSheets[i].href!='undefined') && (document.styleSheets[i].href) && (document.styleSheets[i].href.indexOf('/global')==-1)) continue;
         if (typeof document.styleSheets[i].cssText!='undefined')
         {
            cssText+=document.styleSheets[i].cssText;
         } else
         {
            var rules=[];
            try { rules=document.styleSheets[i].cssRules?document.styleSheets[i].cssRules:document.styleSheets[i].rules; }
            catch (e) {};
            if (rules)
            {
               for (var j=0;j<rules.length;j++)
               {
                  if (rules[j].cssText)
                     cssText+=rules[j].cssText+"\n\n";
                  else
                     cssText+=rules[j].selectorText+'{ '+rules[j].style.cssText+"}\n\n";
               }
            }
         }
      }
      head+=cssText+'<\/style>';

      var de=window.frames[frame].document.documentElement;
      if (!de) return;
      var body=de.getElementsByTagName('body');
      if (body.length==0)
      {
         setInnerHTML(de,'<head>'+head+'<\/head><body class="re_body"><div class="spaced"><div class="ajax_tree_list_loading"><img class="inline_image_2" src="'+'{$IMG*,bottom/loading}'.replace(/^http:/,window.location.protocol)+'" alt="{!LOADING^;}" /> {!LOADING^;}<\/div><\/div><\/body>');
      } else
      {
         body[0].className='re_body';

         var head_element=de.getElementsByTagName('head')[0];
         if (!head_element)
         {
            head_element=document.createElement('head');
            de.appendChild(head_element);
         }

         if (de.getElementsByTagName('style').length==0) {$,The conditional is needed for Firefox - for some odd reason it is unable to parse any head tags twice}
            setInnerHTML(head_element,head);
         setInnerHTML(body[0],'<div class="spaced"><div class="ajax_tree_list_loading"><img class="inline_image_2" src="'+'{$IMG*,bottom/loading}'.replace(/^http:/,window.location.protocol)+'" alt="{!LOADING^;}" /> {!LOADING^;}<\/div><\/div>');
      }
      var style=de.getElementsByTagName('style')[0];
      if ((style) && (style.styleSheet)) style.styleSheet.cssText=cssText; {$,For IE}
   {+END}

   var ifuob=window.top.document.getElementById('iframe_under');
   var extra=ifuob?((window!=window.top)?findPosY(ifuob):0):0;

   window.top.smoothScroll(findPosY(pf)+extra-leave_gap_top);
}


Become a fan of ocPortal on Facebook or add me as a friend. Add me on on Twitter.
Was I helpful?
  • If not, please let us know how we can do better (please try and propose any bigger ideas in such a way that they are fundable and scalable).
  • If so, please let others know about ocPortal whenever you see the opportunity.
  • If my reply is too Vulcan or expressed too much in business-strategy terms, and not particularly personal, I apologise. As a company & project maintainer, time is very limited to me, so usually when I write a reply I try and make it generic advice to all readers. I'm also naturally a joined-up thinker, so I always express my thoughts in combined business and technical terms. I recognise not everyone likes that, don't let my Vulcan-thinking stop you enjoying ocPortal on fun personal projects.
  • If my response can inspire a community tutorial, that's a great way of giving back to the project as a user.
Back to the top
 
Posted
Rating:
#70064
Avatar

Community saint

Much better, thanks Chris!

Do you have a Samsung Galaxy S / Galaxy S II ? If so, why not check out my ScreenFree FM Radio .
Back to the top
 
There are too many online users to list.
Control functions:

Quick reply   Contract

Your name:
Your message: