You are viewing limited content. For full access, please sign in.

Question

Question

Scrolling Javascript breaks on User Task step

asked on July 26, 2017

Hi,

Currently implementing some scrolling Javascript (jQuery) on buttons to get them to smoothly scroll down to the section of the form. Works great when it's submitted, but when it i sand passed to the next step as a user task it ends up breaking. Anyone know if theres a workaround ?

The line that breaks is " if ($id.length === 0) {" it seems to find the element fine on click and can assign the variables but it can't return the value.

 

   $(document).on('click', 'a[href^="#"]', function(e) {
          // target element id
          var id = $(this).attr('href');	
		
          // target element
          var $id = $(id);
         
          if ($id.length === 0) {
           // if (!id[0]){
              return;
         }

          // prevent standard hash navigation (avoid blinking in IE)
          e.preventDefault();

          // top position relative to the document
          var pos = $id.offset().top;

          // animated top scrolling
          $('body, html').animate({scrollTop: pos});
        //document click end
      	});

 

0 0

Answer

SELECTED ANSWER
replied on July 26, 2017

Hi Alex,

Form is inside iframe in user task and the scrollbar is not on the form html/body, but on the $('.lf-vertical-scroll') element outside the iframe (Forms 10.2.0/10.2.1).

To make the scrolling work, you need to scroll that element instead. The script is like:

window.parent.$('.lf-vertical-scroll').animate({scrollTop: pos});
1 0
replied on July 27, 2017

Works great cheers. Had a feeling it was something to do with the iFrame but I wasn't sure what to target. 

0 0

Replies

You are not allowed to reply in this post.
You are not allowed to follow up in this post.

Sign in to reply to this post.