Shape 5

Joomla Templates => Basics - Club => : orbitcod March 02, 2010, 12:39:57 AM



: Show/Hide Text in an Article? [Answered ]
: orbitcod March 02, 2010, 12:39:57 AM
Say if I wanted to have an element to Show/Hide text in an Article what would I do and what would I edit?

   1. <html>
   2. <head>
   3. <title>Untitled</title>
   4. <script language="JavaScript">
   5. function showAndHide(theId) {
   6.   var el = document.getElementById(theId);
   7.     var link = document.getElementById("moreLink");
   8.
   9.   if (el.style.display=="none") {
  10.    el.style.display="block"; //show element
  11.         link.innerHTML = "Hide Links...";
  12.   }
  13.   else {
  14.    el.style.display="none"; //hide element
  15.         link.innerHTML = "More...";
  16.   }
  17.     return false;
  18. }
  19. </script>
  20. </head>
  21. <body>
  22. <div style="padding-top:400px">
  23. 01-Intro (http://www.blah.com/)

  24. 01-Intro (http://www.blah.com/)

  25. 01-Intro (http://www.blah.com/)

  26. </div>
  27. <p><a id="moreLink" href="#" onClick="return showAndHide('Title')">More...[/url]</p>
  28. <div id='Title' style="display:none">
  29. 01-Intro (http://www.blah.com/)

  30. 01-Intro (http://www.blah.com/)

  31. 01-Intro (http://www.blah.com/)

  32. </div>
  33. </body>
  34. </html>

Thanks


: Re: Show/Hide Text in an Article?
: mikek March 02, 2010, 09:00:26 AM
Hello, that would require some custom programing but basically you just want javascript to change the css display call by changing it from display:none on load to display:block when it's clicked.


: Re: Show/Hide Text in an Article?
: orbitcod March 02, 2010, 10:23:49 AM
Ok thanks for the reply.
Where would I locate this .css for articles?

That should be easy.


: Re: Show/Hide Text in an Article?
: mikek March 02, 2010, 02:50:59 PM
Hello, that's part of the problem, the articles need to have unique id's on them to do that, they don't, they only use the classname .contentpage. So there is nothing to identify a single article.


: Re: Show/Hide Text in an Article?
: orbitcod March 02, 2010, 04:07:56 PM
Ahh. Ok thanks.

++ Fast Replies :D