How to Make an Expanding Text Container?

Is it possible to create a div tag (or some type of container
object) that can reference a large body of text (such as a long
article for example) and only show the first few paragraphs with a
link at the bottom to expand the container to show the entire
contents pushing any objects below it further down the page?
I'm using php to include a large html article inside of a div
tag on a newsletter page and would like to learn how to create a
partial display that can expand to show everything only if the user
decides to read more.
Could someone please point me in the right direction in order
to learn how to do this?
Thanks!
~Greg

Here is what you have in the onclick event :
if(document.getElementById('article_snippet').style.display
== 'block') {
document.getElementById('article_snippet').style.display =
'none';
document.getElementById('article').style.display = 'block';
}else{
document.getElementById('article').style.display = 'none';
document.getElementById('article_snippet').style.display =
'block'
On first click, you are checking 'article_snippet' for the
value of
.style.display However, the wayt it works is that .style
values are
NEVER the one in an external, or even an embedded style
sheet. They is
ONLY the ones in *inline* styling. And your div does not have
that
style inline initially.
So, on the first click, no such style is found, and the else
phrase is
run, setting an INLINE value for
article_snippet.style.display to 'block'.
Then on the second click the first condition is met because
the element
now has an inline style with display=block, And the script
now runs as
you thought it would on first click.
Does that make sense?
E. Michael Brandt
www.divaHTML.com
divaGPS | divaFAQ
www.valleywebdesigns.com
JustSo PictureWindow
Myrrhlin225 wrote:
> Hello Again,
> Well, I managed to get this to "almost" work based on
the resource posted
> above by Alec. However, given my limited experience with
javascript, I seem to
> have a slight problem in that the show/hide link must be
clicked TWICE (but
> only the first time) in order for everything to work
properly.
>
> Could someone who really knows javascript please have a
look at my source code
> and tell me what I might need to change in order to get
this toggling link to
> work when a user clicks on it for the first time? I just
don't want people to
> have to click twice in order to see the full article.
>
> Thanks!
> ~Greg
>

Similar Messages

  • How to make separate/individual text frame from one parent frame in indesign with javascript

    Hi all,
    Please suugest - how to make separate/individual text frame from one parent frame in indesign with javascript.
    Thanks
    Rohit

    @Larry – ah, your interpretation could be the right one…
    May I rephrase the question:
    "How to split threaded text frames to single ones?"
    "SplitStory.jsx" or "BreakFrame.jsx" under Scripts/Samples indeed could be the answer.
    From the comments in the code of "BreakFrame.jsx":
    //Removes the selected text frame (or text frames) from the
    //story containing the text frame and removes the text contained
    //by the text frame from the story.
    //If you want to split *all* of the text fames in the story, use the
    //SplitStory.jsx script.
    Uwe

  • How to make a dynamic text  be SMS by fl2.1

    Now ,I know use " getURL("sms:"+telnumber) "to send sms to a
    specified no.,but how to make a dynamic text be the sms content.?
    Many thx!:

    Ciao,
    this should work:
    smstxt = "ciao, happy holidays";
    telnum = "1234567890";
    getURL("sms:"+telnum+"?body="+smstext);
    body is a keyword.
    Alessandro

  • How to make Dynamically Shortened Text With "Show More"

    Hi there! i want to know how to make dynamically shortened text with show more or read more in my website using HTML 5 pages  or ASP.NET ?
    example like these paragraphs 
    Lorem Ipsum är en utfyllnadstext från tryck- och förlagsindustrin. Lorem ipsum har varit standard ända sedan 1500-talet, när en okänd boksättare tog att antal bokstäver och blandade dem för att göra ett provexemplar av en bok. Lorem ipsum har inte bara överlevt fem århundraden, utan även övergången till elektronisk typografi utan större förändringar. Det blev allmänt känt på 1960-talet i samband med lanseringen av Letraset-ark med avsnitt av Lorem Ipsum, och senare med mjukvaror som Aldus PageMaker.
    Det är ett välkänt faktum att läsare distraheras av läsbar text på en sida när man skall studera layouten. Poängen med Lorem Ipsum är att det ger ett normalt ordflöde, till skillnad från "Text här, Text här", och ger intryck av att vara läsbar text. Många publiseringprogram och webbutvecklare använder Lorem Ipsum som test-text, och en sökning efter "Lorem Ipsum" avslöjar många webbsidor under uteckling. Olika versioner har dykt upp under åren, ibland av olyckshändelse, ibland med flit (mer eller mindre humoristiska).
    I motsättning till vad många tror, är inte Lorem Ipsum slumvisa ord. Det har sina rötter i ett stycke klassiskt litteratur på latin från 45 år före år 0, och är alltså över 2000 år gammalt. Richard McClintock, en professor i latin på Hampden-Sydney College i Virginia, översatte ett av de mer ovanliga orden, consectetur, från ett stycke Lorem Ipsum och fann dess ursprung genom att studera användningen av dessa ord i klassisk litteratur. Lorem Ipsum kommer från styckena 1.10.32 och 1.10.33 av "de Finibus Bonorum et Malorum" (Ytterligheterna av ont och gott) av Cicero, skriven 45 före år 0. Boken är en avhandling i teorier om etik, och var väldigt populär under renäsanssen. Den inledande meningen i Lorem Ipsum, "Lorem Ipsum dolor sit amet...", kommer från stycke 1.10.32.
    Den ursprungliga Lorem Ipsum-texten från 1500-talet är återgiven nedan för de intresserade. Styckena 1.10.32 och 1.10.33 från "de Finibus Bonorum et Malorum" av Cicero hittar du också i deras originala form, åtföljda av de engelska översättningarna av H. Rackham från 1914.

    Moved to the main Dreamweaver support forum.
    There are several ways you could approach this. Here's one you might try:
    Give the first paragraph an ID, such as "first", and wrap the paragraphs you want to hide in a <div> with another ID, such as "more". Then add the following block of JavaScript just before the closing </body> tag of the page:
    <script>
    var first = document.getElementById('first'),
         more = document.getElementById('more'),
         trigger = document.createElement('span');
    trigger.id = 'trigger';
    trigger.innerHTML = 'Show less';
    first.appendChild(trigger);
    function toggleDiv() {
      var state = more.className,
           text = trigger.innerHTML;
      more.className = (state == 'open') ? 'closed' : 'open';
      trigger.innerHTML = (text == 'Show more') ? 'Show less' : 'Show more';
    toggleDiv();
    if (trigger.addEventListener) {
        trigger.addEventListener('click', toggleDiv, false);
    } else if (trigger.attachEvent) {
      trigger.attachEvent('onclick', toggleDiv);
    } else {
      trigger.onclick = toggleDiv;
    </script>
    This gets references to the "first" paragraph and the "more" <div>. It also creates a <span> with the ID "trigger" that's appended to the "first" paragraph. The rest of the script defines a function called toggleDiv(), which toggles the "more" <div> open and closed, and changes the text in the "trigger" <span>.
    You also need to create the following style rules for the various elements:
    <style>
    #trigger {
        text-decoration: underline;
        color: blue;
        cursor: pointer;
    #more {
        transition: ease-out .7s;
        overflow: hidden;
    #more p:first-child {
        margin-top: 0;
    #more.closed {
        height: 0;
        -webkit-transform: translateY(-600px);
        transform: translateY(-600px);
    #more.open {
        -webkit-transform: translateY(0);
        transform: translateY(0);
        max-height: 600px;
    #more + p {
        margin-top: 0;
    </style>
    This solution hides the text and creates the "trigger" <span> only if JavaScript is enabled in the browser. It should work in all browsers, including Internet Explorer 8 and earlier.

  • How to make a tts text-to-speech keyboard shortcut

    Hi,
    How do I make a tts text-to-speech keyboard shortcut
    to control the OSX "Speech" available as a contextual menu
    when you right-click selected text in Safari, TextEdit and other native apps
    *Speech > Start Speaking*
    *Speech > Stop Speaking*
    I can get this far:
    *System Preferences > Keyboard > Keyboard Shortcuts >*
    I have low-vision and need this on as many as possible or all text running on my computer.
    Less important: The "Speech" contextual menu is not available right-clicking text in Google Chrome. I could sure use it there too.
    THANKS!

    If you want it turned on permanently open Universal Access preferences, click on the Seeing tab, turn on VoiceOver. Click on the VoiceOver Application button for more configuration options.
    There's also a shortcut option for TTS in the Speech preferences.

  • How to make a impressive text animation?

    Hi everyone,
    I have completed my video, but now I want to add some text to it, I tried using title, and I love one of those style in there, but I want to make a impressive text animation (transition). There's no way I can do it with the effect control tab, I want text appear and disappear with fire around or appear like typing style something like that. Is that anyway to do it, or any other softwares that can easily do what I expected? Please help, this is urgent.
    Thank you.

    Besides the great suggestions so far, you might want to look into a couple of 3rd party programs:
    BluffTitler (I think that it has a "fire" Effect as a Preset, and does have "Typewriter")
    ProDAD's Vitascene, along with their Heroglyph
    Pixelan's Spice Master (more for Transitons, but you can create custom Effects too)
    Good luck,
    Hunt

  • How to make the LONG TEXT as mandatory

    Hi,
    In one tansaction, I need to make the LONG TEXT as mandatory.
    or
    I need to raise an Error message if the long text is empty.
    Thanks

    I want to make the long text mandatory in the transaction F-66.
    In this, long text field (text box) is not displaying directly for typing.
    We need to click on the button LONG TEXT, then text box is opening for typing.
    I need to make this as mandatory.
    Thanks

  • How to make ? nr of container text fields

    hi have this fla wich has 2 sets of containing text fields
    after a php file gets the only two rows in a database, it puts the values in the textfields.
    now what i want is
    i want flash to put the instances of the textfields automatic on the stage
    like when there are 8 rows, i want 8 sets of textcontainers.
    how do i do thiss.
    i have this really simpel fla file
    wich can be downloaded here
    http://www.flash-db.com/Tutorials/loadingAS3/loadingAS3_flash-db.rar
    its in the BD folder, also the php file
    would be so nice if someone could edit the fla file, so i can check out how this is done?
    or maybe a tutorial on this or something?
    thx so much in advance

    Hi Allice,
    You can use this :-
    for ( var i=0;i<8;i++)
    var txt:TextField=new TextField();
    txt.name="txt"+i
    txt.x = 0
    txt.y=i*10
    addChild(txt)

  • How to make grid without text etc., expand upon load of app?

    hello,
    i did this,
    JPanel panInner = new JPanel();
    panInner.setLayout(new GridLayout(5, 5, 10, 10));
    then after that, i add 25 labels on each without any text.., the grid looks very small and will enlarge upon entering text.., i don't want that to happen, i want the grid boxes to have a constant size all through out regardless of the text's length.
    also, how do i have a 'fixed size', seems all the component's size fitting to the size of the texts.,
    many thanks! :)

    Submit your feedback directly to Apple using the appropriate link on the Feedback page:
    http://www.apple.com/feedback

  • How to make pages expand and follow previous text?

    I have completed the steps to have a form with expandable boxes and I it functions well.  I need assistance with making the boxes appear one after another on the page and not leaving the blank space.  i have tried converting my 5 page doncument and listing everything under page 1 (it does not work) it stacks all the boxes on top of one another.  I have page 1 flowed, expandable boxes positioned, and page 2 flowed and so on.  Do I need to wrap all the pages in a subform and set it to flowed?  I will have some boxes with javascript functions later in the form.

    Form attached as requested.  This form does not and will not have anything addidtional involved.  I want to have the solution for the new form so I don't have to go back and make changes after I have added my javascript and subforms.
    Thanks for taking a look at this for me.

  • How to make an input text for user to type name in?

    I'm making a game in which the user can type their name, and later in the game it'll say something like:
    "Oh, Kaitlyn, how was your day?" But all I really know how to do is make it so the name will appear but NOT be in an actually sentence. The problem with that is the spacing and punctuation. I tried following a tutorial which gave me this to put in the actionscript for the output box:
    output_txt.text = "Hello "+myText+"!";
    Here's the tutorial:
    http://www.danfergusdesign.com/classfiles/oldClasses/VCB331-richMedia1/exercises/inputOutp utText.php
    I think it's because it's for as3 that it doesn't work, but I'm kinda new to flash and it doesn't seem too difficult. Please give very discriptive instructions.

    What you show will work in AS2 as well as AS3.  Have you assigned an instance name to the textfield (it shows as ' output_txt ' in your example)?  Instance names are assigned by selecting the object on the stage and entering the name in the Properties panel.
    You need to store the name that the user enters into a variable.  This can be done a couple different ways.  Do you have something in place for that?

  • How to make the footer text to come only on the last page

    Hi,
    Iam just making an print forms using adobe forms,Iam havinga text and some variable in the end of the page.these things need to be printed only on the last page.
    if my output of the main window comes for 2 pages then it should print only in the second page not in the first page.
    if the data of my main item data comes to one page then this should be printed on the first page itself.
    how to put a condition on this type of footer windows.
    Thanks in advance.
    regards,
    Sasidhar

    try with the following formcalc Scripting on the subform which contains the footer text...
         var curpage  = $layout.page ( ref ( $ ) )
         var totpages = $layout.pageCount()
         if ( curpage ne totpages ) then
             $.presence = "hidden"
         endif

  • How to make portlet expandable?

    Dear all,
    how can i make the portlet expands depending on its content without making vertical/horizontal scrolls?

    Thats a CSS question. Identify the div and class which applies tp it (use firebug and firefox or develper tools and ie). You have a scroll or overflow , probably auto and an explicit hieght. customise the css to remove this or modify it as you want.

  • How to make jsplitpane expand slowly?

    Hello Everyone
    How can I make a jsplitpane to expand slowly to the otherside? Do I have to create my own Look and Feel in order to do that?
    Thank you!

    hi seems as thought you figured it could you post your code(demo) sounds interisting and i am sure many people would like to know how to do that.
    David

  • How to make a transparent text layer over a photo that scrolls?

    I looked through the Adobe Inspire Magazine, and found something really astonishing: the editor's added a text-over-photo effect multiple times throughout the magazine (See http://inspire.adobe.com/, october 2014. Has to be on the iPad to see the actual effect. "It's about the stories" by Dan Cowles features this effect).
    I was really baffled to see it, as it fits my current project perfectly. I'm building a book about a recent trip to Iceland, which will be released for the iPad in the nearest future. So far, I have used Adobe InDesign CC to create pretty much the entire book, since I know little to nothing about programming.
    My question is, how did they (he) do it?
    Is it possible to do for someone with pretty limited knowledge? If it is, how can I do it?
    Thanks a lot!

    Since Adobe Inspire is made using DPS, then you can do everything that it does.
    At the top of the help document, Digital Publishing Suite Help | Digital Publishing Suite Help, there are links to topics like Getting Started, Design and Layout, System Requirements, etc. Read them over to gain an overview. Also, download and review DPS Tips from the App Store.
    If you are using Creative Cloud 2014, you should already have DPS Tools available to you. DPS is supported for InDesign version 6 and greater. I have found DPS pretty straight forward to use following the information given in the documentation along with help from this forum and DPS Tips.

Maybe you are looking for

  • How to delete checkbox in pdf form using adobe acrobat professional 6.

    I  am trying to modify a pdf form having a single layer. There are some checkboxes which i want to delete. I am using Adobe acrobat 6 professional. USing Advanced Editing tools -> Touchup Object Tool , i have try to delete the checkbox, it deletes al

  • WiFi Problem after iOS 4.3.3 update

    Hi After the update to the IOS 4.3.3 all of the IPAD 2 from my company(six IPAD 2) I started to have many problems connecting to wireless network from my company.I saw that the IOS 4.3.4 the bug persists. I would to now if the IOS 4.3.5 fix this BUg

  • [MB Air 2013] Windows 8 says I need a Boot Camp driver update, but download is unsupported

    Hi all, I'm on a brand new 2013 MB Air running Windows 8 64 bit with Boot Camp. Windows is running fine, but I just recently noticed that I had a message telling me I had a driver missing and needed to update Boot Camp. Now, this computer is less tha

  • Split Parameter

    hi all, i m passing a parameter to function. this parameter can be a word or series of words like 'abc' or 'abc def ..' how i split this parameter string into each separate word in function, means if it is find a 'space' in sentence, it should split

  • Dx0 Filmpack 4 plugin broken in CC

    I found the FAQ, not terribly well earmarked and reinstalled my Nik software plugins from scratch. I find it hard to believe that it was not possible to migrate this very common plugin set, as with Topaz and save hundreds of thousands of users (many