From the course: Hotwire: Reactive Ruby on Rails Applications

Unlock the full course today

Join today to access over 23,200 courses taught by industry experts.

Loading a frame automatically

Loading a frame automatically

- [Instructor] Frames can also load their content automatically without the need for a link to be clicked. This is done by setting a path in the frame. For example, let's make the yellow frame with a page four image response ID to load the image without clicking the link. Just start the SRC attribute and set the URL, in this case, page four. Now, when you reload the page, you can see how the frame loads the image automatically Notice that it has made the fetch request after loading page one. An even more interesting feature is to make it load the content when the frame is visible. This is very useful when the page has a lot of content. To test this feature, remove the top margin of the frame because there isn't any tail in CSS class with as much margin as we need. Add the style attribute and set the top margin to 1000 pixels. Now add the loading attribute with a lazy value. If you reload the page, the frame is no…

Contents