Home » Development » CSS » Seite 7
I am currently developing a drag and drop interface for a course builder. Courses are split into lessons and lessons into slides. While switching between slides, I wanted to have a small thumbnail representing the current slide content.
One option would have been to use something like PhantomJS / CasperJS. A headless browser , to take a screenshot of the slide. I have done that in the past and it works perfectly.
This time, I decided to go with another solution, that allows me to convert html to a canvas element.
The project is called html2canvas (GitHub).
„This script allows you to take screenshots of webpages or parts of it, directly on the users browser. The screenshot is based on the DOM and as such may not be 100% accurate to the real representation as it does not make an actual screenshot, but builds the screenshot based on the information available on the page.“
I have a slide container (#slideContainer), that holds the active slide for editing and a thumb navigation to switch between slides (.slide.thumb).
When switching between slides, I am doing a snapshot of the current slideContainer and add it as a new background image to the thumb navigation item for that slide. This is done with canvas.toDataURL() and by embedding the resulting image using a data: url.
Works perfectly. html2canvas has no full css support, so the output will not always match 100%, but its close enough to get a glimpse of what is stored per slide ;)
„Gisto is a code snippet manager that runs on GitHub Gists and adds additional features such as searching, tagging and sharing gists while including a rich code editor. All your data is stored on GitHub and you can access it from GitHub Gists at any time with changes carrying over to Gisto.“
The application is multi-platform.
The great thing is that Mosaico itself does not define what you can edit or what styles you can change: this is defined by the template.
This makes Mosaico very flexible.“
Nested is a jQuery plugin which allows you to create multi-column and dynamic grid layouts. All completely gap-free.
Nested @ Github
Brick.js offers a blazing fast masonry layout generator for fixed width elements.
okayNav aims to progressively collapse navigation links into an off-screen navigation, instead of doing it for all the links at the same time.
Had to use this for one of my latest Syntax Highlighting tweaks, so that I can use an ordered list, line numbers and still be able to copy & paste the code :)
Again another Google AMP article, this time dealing with Syntax Highlighting. If you have a code centric website, this is important.
In one of my last articles I talked about a Generic Syntax Highlighter. This time I want to show you, how to add Syntax Highlighting with GeSHi to a custom template in AMP-WP.
Please read up on documentation, as I am not diving into every detail.
I was about to write my own, when I found an older article from phoboslab. Thanks Dominic for saving me some time ;) Its not perfect, but close enough.
A simple Syntax Highlighting Class that does just that. The class was not working with PHP 5.4.x+, as it uses preg_replace() with the /e modifier.
It will not cover all, but its better than nothing :) I will also add a section to my my AMP tweaks article to showcase the integration of Geshi.
Here an updated version using the preg_replace_callback() function.