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

Fit / Fill text in slide #316

Closed
alperyilmaz opened this issue Apr 3, 2016 · 4 comments
Closed

Fit / Fill text in slide #316

alperyilmaz opened this issue Apr 3, 2016 · 4 comments

Comments

@alperyilmaz
Copy link

The fit/fill text property in DeckSet (sample) and Spectacle (sample slide3 and slide7) is a nice touch for having beautiful slides. I was trying to integrate fit/fill text property into remark. I decided to try BigText.js library (another alternative is FitText). Currently I have the following lines in HTML:

<script src="https://gnab.github.io/remark/downloads/remark-latest.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script>
<script src="js/bigtext.js"></script>
<script>
var slideshow = remark.create({

// ratio, navigation,slideNumberFormat,countIncrementalSlides,highlightStyle,sourceUrl variables are set here

}); 
</script>
<script>
// Only BigText on “new-ish” browsers
if( 'querySelectorAll' in document ) {
$('.bigtext').bigtext();
}
</script>

When I view the presentation, I had to refresh the slide to see the effect. (same problem with mermaid was described in issue #315

When I refresh, I see that BigText.js works as shown before:

BigText.js sample

My questions are;

  1. What is the best way to integrate an external js library into remark? (do we need to trigger slide events?)
  2. Is it possible to achieve fit/fill text effect by css only?
@dastrobu
Copy link

dastrobu commented Apr 23, 2016

I have the same problem with mermaid and flot. At least some slide loaded to hook on would be nice. I currently did not find any other solution except reloading the page after switching slides, which is not really an option.

@jenokarthic
Copy link

jenokarthic commented Nov 14, 2016

I had the similar issue and found the solution.

Following code receives slideshow - afterShowSlide callback from remarkjs and recreate the bigtext content on current slide.

<script>
slideshow.on('afterShowSlide', function (slide) {
if( 'querySelectorAll' in document ) {
    $('.bigtext').bigtext();
}
</script>

@dastrobu
Copy link

dastrobu commented Nov 16, 2016

@jenokarthic tip works also great with flot and solves the issue.

There is however a problem if you do a page relaod on the page showing the bigtext or flot graph. To be able to reload the page (or open it directly via a deep link), I suggest to do the following:

<script>
$(document).ready(function(){
    function doPlot(){
        $.plot("myPlotSelector", [...]);
    }
    // pass function to afterShowSlide event, to make sure plot is correctly sized
    slideshow.on('afterShowSlide', doPlot);
    // call function to make sure plot is shown when page is loaded directly
    doPlot();
});
</script>

@abelards
Copy link
Collaborator

Thanks everyone, now it's in the wiki!
https://github.com/gnab/remark/wiki/HTML-CSS-JS-samples

ssssam added a commit to ssssam/talks that referenced this issue Jan 9, 2023
Still to do:

  * Fit text - see gnab/remark#316
  * Fit images - see gnab/remark#72
  * Add Codethink logo at start and end
  * Remove 'bottom bar' - ?
  * Make it more beautiful
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