Sometimes it is confusing that the description of the activity is under the title/link on the course main page, and the same text is also visible when you open the activity. On the course view and on the activity view page you might need a little bit different content. Or you would like to mimic the fancy Show more... or Read more... buttons on modern web pages. The following solution will show the button on the course view page but not on the activity page, even if the description is visible on both views. First, we have to add the JQuery code to the usual place: Dashboard > Site administration > Appearance > Additional HTML JQuery
The first part copies the URL to the button from the activity. The second part hides or shows the button based on its URL. If the URL looks odd (ending #), we are very likely on the activity view so we don't want the button to be visible. If the URL looks OK (not ending #), then we are most likely on the course page, therefore we need the button. Now we can add the button to the description of the activity, make it hidden by default and the script will do the rest. An example of the button: HTML
Screenshots: You can see and try all the examples here:
https://lengyelke.com/moodlelts/course/view.php?id=3 Enjoy!
0 Comments
Leave a Reply. |