Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dat-autoslide just run once. #3123

Closed
shokri-navid opened this issue Feb 5, 2022 · 4 comments
Closed

dat-autoslide just run once. #3123

shokri-navid opened this issue Feb 5, 2022 · 4 comments

Comments

@shokri-navid
Copy link

shokri-navid commented Feb 5, 2022

I have two fragments with auto slide attributes. it works great when I step forward once but when I slide backward It will work manually after that no difference between I step backward or forward. It is my code:

          <h1>It left intentionally blank</h1>
        </section>    
        <section>
              <div>
                <p style="color: #1fb992; font-size: 25pt; font-weight: bolder; text-align: left;">
                  Significantly reduced within-patient variability
with insulin detemir vs NPH insulin and insulin
glargine in type 1 diabetes<sup><span style="font-size:8pt;">1</span></sup>
                </p>
              </div> 
              </section>
              <section data-auto-animate-restart>
              <div 
                style="display: flex; 
                background-image: url('https://fn.sec4share.me/Levemir/171/Slide_deck_test/Link-04.png'); 
                background-position: center;
                background-size:100% 100%;">
                <div style="flex: .5;" class="fragment fade-up" data-autoslide ="1000" >
                  <img src="https://fn.sec4share.me/Levemir/171/Slide_deck_test/Link-06.png" style="width: 55%; margin: 7% 0 8% 10%;"/>
                </div>
                <div style="flex: .5;" class="fragment fade-up" data-autoslide ="1500" >
                  <img src="https://fn.sec4share.me/Levemir/171/Slide_deck_test/Link-05.png" style="width: 56%; margin: 13% 0 0 15%;"/>
                </div>
              </div>            
            </section>
            <section>
              <H1>Intentionally Empty Page</H1>
            </section>```

Is there any way two reset all step as its first show?
@mimamo10
Copy link

mimamo10 commented Feb 8, 2022

Yes, I'm having this problem as well. Also the autoslide doesn't seem to work on android Chrome.

@wxnarwhal
Copy link

I'm having the same issue. I've confirmed in Chrome and Firefox. Whenever a slideshow loops, every slide loads in its final state. That means if I have multiple fragments, they are all loaded. If I hide previous fragments, then only the final fragment is shown. The only place I could find this issue mentioned previously was back in 2013, and it was reportedly fixed. #473 Maybe it's unrelated, or maybe the same bug got reintroduced.

@wxnarwhal
Copy link

I'm not really qualified to contribute to this code, and I think there might be a disagreement over the intention, but I think I have fixed it for myself. I looked at how my slides were rendering, as well as the code section mentioned above, and found this section.

Starting at line 1597 in js/reveal.js

if( i < index ) {
	// Any element previous to index is given the 'past' class
	element.classList.add( reverse ? 'future' : 'past' );

	if( config.fragments ) {
		// Show all fragments in prior slides
		Util.queryAll( element, '.fragment' ).forEach( fragment => {
			fragment.classList.add( 'visible' );
			fragment.classList.remove( 'current-fragment' );
		} );
	}
}
else if( i > index ) {
	// Any element subsequent to index is given the 'future' class
	element.classList.add( reverse ? 'past' : 'future' );

	if( config.fragments ) {
		// Hide all fragments in future slides
		Util.queryAll( element, '.fragment.visible' ).forEach( fragment => {
			fragment.classList.remove( 'visible', 'current-fragment' );
		} );
	}
}

I can see that all fragments in prior slides remain visible.

I found the equivalent section in dist/reveal.js, it looks like this:

classList.add("present"):a<t?(o.classList.add(s?"future":"past"),l.fragments&&yh(o,".fragment").forEach((function(e){e.classList.add("visible"),e.classList.remove("current-fragment")}))):a>t&&(o.classList.add(s?"past":"future"),l.fragments&&yh(o,".fragment.visible").forEach((function(e){e.classList.remove("visible","current-fragment")})))}

Remove where the visible class is being added, and add the visible class to the section where classes are removed, and it looks like this:

classList.add("present"):a<t?(o.classList.add(s?"future":"past"),l.fragments&&yh(o,".fragment").forEach((function(e){e.classList.remove("visible","current-fragment")}))):a>t&&(o.classList.add(s?"past":"future"),l.fragments&&yh(o,".fragment.visible").forEach((function(e){e.classList.remove("visible","current-fragment")})))}

I absolutely believe that an option for this should be added to the code, otherwise there's no point in having a loop option for the slideshow if the slideshow is fundamentally incapable of playing correctly after the first time. reveal.js is amazing and I wish I knew enough to contribute. I'm grateful for the effort put into development.

@hakimel
Copy link
Owner

hakimel commented Apr 4, 2022

I've fixed the inconsistent behavior with fragment visibility in looping presentations. Fragment visibility should now behave the same when looping as it does for other slide navigation.

If you loop from end to beginning, all fragments are hidden/reset. If you loop from beginning to end, all fragments are visible when stepping backwards.

Tested in FF/Chrome and with the sample of code in the original issue report. Let me know if you still notice any weirdness!

@hakimel hakimel closed this as completed Apr 4, 2022
samwize pushed a commit to samwize/reveal.js that referenced this issue Jun 9, 2022
* hakimel/master: (1422 commits)
  tweak slides mention
  fix issues with overflowing fit-text when exporting to pdf hakimel#3191 hakimel#3120
  Fix typo in plugin.js
  notes plugin only listens for same-origin postmessages to prevent xss
  new attempt at speaker view xss fix
  add support for 'data-background-gradient' hakimel#2510
  fix issue where auto-animate did not work when jumping three or more slides (i.e. longer than the view distance)
  made data-background attribute work with .webp hakimel#3200
  fix: truncated long r-fit-text on pdf
  update link
  fix issue with hakimel#3182 when slide numbers are disabled
  fix inconsistent fragment visibility in looping presentations hakimel#3123
  fix: pdf page numbering for fragment group
  always use css transforms for presentation scaling (zoom has too many quirks even if it is slightly sharper on ldpi displays)
  update lock file
  4.3.1
  notes plugin allows messsages from current/upcoming slide windows
  fix hakimel#3154
  fix vertical slide link in demo hakimel#3155
  dont run full build + tests for package task hakimel#3156
  ...
srwohl pushed a commit to srwohl/phantom-pres that referenced this issue Sep 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants