cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Shar
Community Champion

Accordion Alternative - Details tag

Jump to solution

Howdy! A friend showed me the details tag the other day and now I cannot stop telling others about it.

It's an HTML5 tag so it works in mobile too! See more at The Details disclosure element.

Spoiler
The spoiler reminds me of the details tag!

I added some styling to the main parts. Here is the code to try in your Canvas page:

<details>

 <summary style="background-color: whitesmoke; font-weight: bold; cursor: pointer;">
  Some question here? <small>(click to reveal)</small></summary>

 <div id="reveal" class="pad-box-mini border-round" style="border: thin solid grey;">
<p>Reveal text goes here</p>
</div>

</details>

I've already started using it on pages to split up large content blocks including video! I found the old places where the accordion was used and replaced each with its own details block.

Group of details to mimic an accordionGroup of details to mimic an accordion

 

Cheers - Shar

Labels (2)
31 Replies
mtuten
Community Contributor

Interesting. I'll have to look at it after a while, but it sounds like you might have it all figured out. 🙂

View solution in original post

0 Kudos
Seth_LD
Community Member
0 Kudos
asells
Community Member

Thanks Shar!

🙂  Alissa

View solution in original post

0 Kudos
jgerber2
Community Participant

Has anyone been successful in using the <details open> attribute to have the details be displayed when the page is loaded?   I'd like to have a section of details a page be displayed upon page load, but then have a user be able to close.   It appears that Canvas removes the open from the html, leaving the default closed state.

View solution in original post

0 Kudos
adamboyce
Community Participant

I've been using the details tag thanks to your insight @Shar! However, when I insert course media it doesn't show after saving... You mentioned videos worked in your description, so any advice would be awesome.

Do I need to be in the html editor rather than the RCE when inserting the iframe for some reason?

View solution in original post

Tags (3)
0 Kudos
Shar
Community Champion

Hi there @adamboyce !

Hmm, I had some trouble recently trying to put H5P content (hotspot type) under a details tag; the content would not display. But I've used the details tag successfully with YouTube video.

I just tried it now with a quick Canvas record-video and no problem there either. Here's what I did:

  1. HTML Mode, set up the details, summary, and placeholder text for the video
  2. Classic RCE, used the Record/upload media button at my placeholder video text
  3. Saved and waited for the video to process.
<details>
<summary>Example Video from Shar</summary>
<p>Video here</p>
<p><a id="media_comment_m-2cVzH7FEMypuA6Krirf7KmRFWwgpNWTz"
class="instructure_inline_media_comment video_comment"
data-media_comment_type="video" data-alt=""></a></p>
</details>

No iframe at all with that content. Here's the code I used for my YouTube video. I use a method of inline responsive-embedding that limits the video width so it's not overly huge on really large screen displays.

<details>
<summary>Prototyping for better eLearning: Part 1 (8:26)</summary>
<div id="outer" style="max-width: 640px; margin: auto;">
<div class="embed-container"
style="position: relative; padding-bottom: 56.25%; height: 0; overflow: hidden; max-width: 100%;">
<iframe
style="position: absolute; top: 0; left: 0; width: 100%; height: 100%;"
src="https://www.youtube.com/embed//o3IGxWKDu-E?rel=0"
allowfullscreen="allowfullscreen"></iframe></div>
</div>
</details>

What kind of media are you using? Are you using the new RCE? Perhaps there's some issue there that I'm unaware of with the use of iframes.

Let me know, I'm happy to help you troubleshoot. Paste your code if you can. 😊
Cheers - Shar

View solution in original post

Tags (2)
adamboyce
Community Participant

Yes, I'm using the New RCE and added previously recorded course media via the dropdown menu pictured. I'll try out some of the code you've provided, but mine is below.

 Screenshot 2020-12-02 161152.png

<hr />
<details>
<summary><strong>What if I need to miss a week?</strong></summary>
You're in a pickle <iframe style="width: 400px; height: 225px; display: inline-block;" title="Video player for [Untitled Wed Sep 23 2020 15:16:30 GMT-0600 (Mountain Daylight Time)]" data-media-type="video" src="https://*ourinstitution*.instructure.com/media_objects_iframe/m-65j3H4tZuFcGyhqFmu7XNa4qZH1ifswA?type=video" allowfullscreen="allowfullscreen" allow="fullscreen" data-media-id="m-65j3H4tZuFcGyhqFmu7XNa4qZH1ifswA"></iframe>
</details>
<hr />

View solution in original post

0 Kudos
adamboyce
Community Participant

Using your code adjusting the data-media-id worked (m-65j3H4tZuFcGyhqFmu7XNa4qZH1ifswA), however the video shows up as a small thumbnail and then expands to almost the entire screen when clicked. I noticed the media player is also different. I probably need to play with the style to figure out the sizing issues, but this is definitely a good workaround if there really is no way for the iframe to be active under the details tag. Thanks @Shar!

classic media player:

adamboyce_1-1606952322367.png


iframe media player: 

adamboyce_0-1606952252695.png

 

View solution in original post

Shar
Community Champion

Hi again @adamboyce ,

Ahh I think it's definitely something with the new video player used in the new RCE. I just tried it and yeah, in the edit mode the video shows up, but once we press save it fails to load. I suspect it's something to do with the order that things load in.

At any rate, for the old video, I slipped a <div style="max-width: 400px;"> </div> around the <a> </a> and that keeps my video the same size as the new media player. I'm still going to keep messing around with the new video player to see what I can come up with, otherwise, we'll have to remember the link to data-media-id trick.

Cheers - Shar

View solution in original post

Shar
Community Champion

Hi again again @adamboyce 

By the way, have you looked at the videos on mobile? The Canvas media comment videos show up as regular videos in mobile ready to view with a press of the play button (yay!).

It's the iframe tag that's definitely causing the issue, more specifically the iframe video player, the html5 video tag works so much better under the details. But the src is an ugly long string; I'm guessing that's the reason they made a media_objects_iframe directory.

<p><video name="media" width="400" height="225" controls="controls">
<source
src="https://iad.cdn.nv.instructuremedia.com/originals/o-2cWcj8esU6h5TkrUPMNjKMw6YA4DJeuL/transcodings/t-2dc1inMbD7TV83Yne9bopwjYdvYxFZnS.mp4"
type="video/mp4" /></video></p>

I've truncated the src URL in the above snippet because it's such a hideous run of characters including an expiration date that seems to be from when I generated the string. At any rate, here's what I did to get the video code and source.

  1. in New RCE, embedded the course video on the page.
  2. Saved the page.
  3. Right-click on video and select Open video in a new tab
  4. In the new tab, Right-click on video and select Inspect
  5. In the inspect frame, Right-click on video tag and select Copy element
  6. Back to Canvas page, Edit,  switch to HTML editor. Paste in code before closing details tag.
  7. Switch to RCE to allow Canvas to update the code
  8. Switch back to HTML, edit width to 400 and height to 225.
  9. Saved the page.
  10. Looked at it on the Canvas mobile app.

Yeah, that's a lot of work for a possibly persistent video tag under a details. But if your page is going to be stable and no one else is going to go in and mess with it, then it's worth a shot at doing. Are you making an FAQ page? Is that video going to remain in the course?

I'm going to keep my test page and set a reminder to see if it's still viable tomorrow and in three months.
I hope this helps you out, I know I'm going to document the process for the future when the New RCE is the only thing available.
Cheers - Shar

View solution in original post

Tags (2)