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.

Similar Messages

  • How to make dynamic select list with time interval of 15 minutes

    Dear all,
    I've a question. I need a select list that contains time with intervals of 15 minutes from 08:00 till 16:00.
    example 8:00
    8:15
    8:30
    8:45
    9:00
    9:15
    and so on till 16:00
    The values or stored in a varchar column.
    Can someone please help me with this one?
    Best regards,
    Caroline

    I think the easiest way would be to create a table "INTERVALS" with one row and column "INT_PERIOD"? per 15 minute period description
    8:00
    8:15
    16:00
    Then create your select list item based on a Dynamic List, or Query as
    SELECT int_period d, int_period r
    FROM INTERVALS
    ORDER BY INT_PERIODYou could write something to load the table, but that might take about as long to just edit in the values.
    Making it a Dynamic LOV, you then have it available anywhere else you might need it.
    Edited by: Bob37 on May 4, 2012 8:57 AM

  • 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 dynamic search items in a report?

    Hi all,
    I have two questions.
    1. How to make dynamic search (i.e without GO button) field above report to provide dynamic search by words in one field of report query?
    2. How to make similar multiply dynamic search fields on report to provide individual search by selected fields of report with refine capability (i.e any search conditions in different fields must work together as complex WHERE clause)
    Thanks in advance

    hey yuri--
    if i'm understanding your questions correctly, the easiest way to achieve the functionality you're after is to have your query criteria fields submit the page when values are entered/selected. the page should then branch back to itself using the submitted criteria in the query. because you're asking about dynamically adding in your where clause predicates, you should consider using a report region of type "SQL Query (Pl/sql Function Body Returning SQL Query)". that way you can use pl/sql to piece together your query based on the provided criteria.
    so the part of your question i'm not sure of is when your page should submit itself ("without a GO button" as you said). for your first question, it seems to be a simple matter of javascript. you want users to be able to enter search criteria into a field and have that criteria be using in the report. to facilitate that we have a few self-submitting item types such as "SelectList with Submit" and "Text Field (always submits page when Enter pressed)". for your second question, it seems that you should have a Go button for the user to indicate he's done entering in his query criteria. anyhow, that's up to you, i suppose. hopefully this response will give you the concepts you need to implement this as you'd like.
    regards,
    raj
    ps-after re-reading your post, i now realize there's a chance that you wanted users to not have to submit the page at all when filtering their result sets. if that's the case, you'd have to use javascript for that cumbersome feat. google would be a good place to go for that code.

  • How in Illustrator I write text with transparent background ?

    How in Illustrator I write text with transparent background ?

    that is correct. You open it in AI and you have an option to use area text, you first take the text tool and drag to make a text frame, which wors like it does in a layout program. Or you click the text tool any where on the canvas and just start typing if you want to make another line you either hit the return (enter) key or for  soft return use shift/return (enter).
    The default is a transparent background.
    All art i Illustrator is on a transparent background unless you add an object behind other objects that has a fill color.

  • HT203254 how to make whats on my computer show on my t.v.

    how to make whats on my computer show on my t.v.

    I'm presuming that you've already made the connection with a suitable cable.  What are you getting on the TV?  Are you getting a completely blank screen?  Are you getting a message similar to 'no input detected'? Or are you getting the spiral galaxy desktop?
    If the last of these then what you have is an extended desktop.  If you move the mouse cursor off the edge of the MBP's screen you will see it appear on the TV.  Similarly you can drag windows from the MBP's screen to the TV.  At present the MBP's screen is the primary display and shows the menu bar and dock, and the TV is the secondary display.  To change this go into System Preferences -> Displays -> Arrangement.  You will see an image of two screens, a smaller one representing the MBP's display and a larger one representing the external display.  At the top of the smaller screen in the image is a bar, this represents the menu bar at the top of the screen.  Drag it from the smaller screen to the larger screen.  The external display will become the primary display and the menu bar and dock will appear there and any new windows or applications that you open subsequently will appear there too.
    silvergc's suggestion to use mirroring will work, but you won't be using the native resolution of the TV which could result in fuzziness or bluriness of the image on the TV.

  • I have updated to io7 but it wont let me recieve or make calls or texts its showing i have no signal but i can recieve internet ive tried everything can anyone help?

    i have updated to io7 but it wont let me recieve or make calls or texts its showing i have no signal but i can recieve internet ive tried everything can anyone help?

    i have there is nothing wrong with the signal in my area, and they have told me check the mobile data network and i have done everything including reseting everything but its still not working

  • How do I get Alt text to show in DreamweaverCC

    Please excuse my ignorance. I would like to know how to get the Alt text to show when hovering over images. It use to happen naturally in Dreamweaver 3, but now in the latest CC version it doesn't seem to work. I use it to link images to pages so when some one hovers over an image the finger points but no text appears? Is there a setting I have missed as I can't type in the code as I'm a novice? Any advice would be appreciated. The pages are all htm.

    Hi Atrforrooms,
    Use Image Property Inspector dialog in Dreamweaver CC. There is title field, whose value will be displayed on hovering over the image.
    Below is the snapshot for better understanding and title is highlighted there. Try this and let us know if that worked for you.
    Wish you luck.
    thanks,
    lnayal

  • How can I send a text with a picture attachment on my new iPhone5c?

    How can I send a text with a picture attachment on my new iPhone5c? It won't send or recieve!!.

    Does your carrier support it?
    Follow the steps in this guide.
    http://www.imore.com/how-send-photo-using-imessage

  • How to make SAP B1 connection with Windows Sharepoint Service 3.0

    how to make SAP B1 connection with Windows Sharepoint Service 3.0 through asp.net web part code.. I get the security error when i run that web part......
    public bool ConnectToCompany()
                oCompany = new SAPbobsCOM.Company();
                oCompany.Server = "192.168.1.58";
                oCompany.DbServerType = SAPbobsCOM.BoDataServerTypes.dst_MSSQL2005;
                oCompany.CompanyDB = "SBODemoUS";
                oCompany.DbUserName = "sa";
                oCompany.DbPassword = "abc";
                //oCompany.UseTrusted = true;
                oCompany.UserName = "manager";
                oCompany.Password = "manager";
                oCompany.language = SAPbobsCOM.BoSuppLangs.ln_English;
                oCompany.LicenseServer = "192.168.1.58:30000";
                int i = oCompany.Connect();
                if (i != 0)
                    return false;
                return true;
    protected override void RenderContents(HtmlTextWriter writer)
                if (conn.ConnectToCompany() == true)
                    writer.Write("Hello" + this.Context.User.Identity.Name);
    Edited by: bikalg on Nov 28, 2010 9:43 AM

    Hi.......
    Welcome to SAP Business One Forum.....
    Unfortunately this is the wrong forum you posted here.
    I would suggest you post it in SDK or System Administration Forum and definitely you get the solution and close this thread from here......
    Regards,
    Rahul

  • How to make a PDF form with expanding tabel or expanding fields, like in Word.

    How to make a PDF form with expanding tabel or expanding fields, like in Word.

    This is currently not possible in Formscentral. It is something we are working on for the future. Please stay tuned.
    Andrew Yarborough

  • Is their any tutorials on how to make a navigation bar with drop downs in Dreamweaver CC now ?

    Is their any tutorials on how to make a navigation bar with drop downs in Dreamweaver CC now that they do not have the spry option?

    bbull2005 wrote:
    Preran, why wouldn't Dreamweaver include it's own menu/navigation bar widget?
    I can't answer on Preran's or Adobe's behalf, but I think you'll find at least part of the answer here: http://wiki.jqueryui.com/w/page/38666403/Menubar
    Adobe decided to discontinue development of Spry in August last year, and Dreamweaver CC made the switch to using jQuery UI widgets and effects. One reason for dropping Spry was that it failed to work correctly in some browsers. Judging from the fact that the jQuery UI menubar is now "on ice", creating a flyout menu that works reliably across all devices is proving more difficult than originally envisaged.
    Because all other widgets in Dreamweaver CC use jQuery UI, it's a reasonable assumption that Adobe hoped the jQuery UI menubar would be ready in time, but it wasn't.

  • How to create dynamic connection string with variables using ssis.

    Hello,
    Can anyone let me know on how to create dynamic connection string with variables using ssis?
    Any help would be appreciated.

    Hi vinay9738,
    According to your description, you want to connect multiple database from multiple servers using dynamic connection.
    If in this case, we can create a Table in our local database (whatever DB we want) and load all the connection strings.  We can use Execute SQL Task to query all the connection strings and store the result-set in a variable of object type in SSIS package.
    Then use ForEach Loop container to shred the content of the object variable and iterate through each of the connection strings. And then Place an Execute SQL task inside ForEach Loop container with the SQL statements we have to run in all the DB instances. 
    For more details, please refer to the following blog:
    http://sql-developers.blogspot.kr/2010/07/dynamic-database-connection-using-ssis.html
    If there are any other questions, please feel free to let me know.
    Regards,
    Katherine Xiong
    Katherine Xiong
    TechNet Community Support

  • [svn:fx-4.x] 14531: Need to make sure that text with textLine.x 0 is clipped.

    Revision: 14531
    Revision: 14531
    Author:   [email protected]
    Date:     2010-03-02 13:40:41 -0800 (Tue, 02 Mar 2010)
    Log Message:
    Need to make sure that text with textLine.x < 0 is clipped.  This becomes a much more common case when direction=rtl and the text is wider than the available width.
    QE notes:
    Doc notes: None
    Bugs: SDK-25689
    Reviewed By: Hans
    Tests run: checkintests
    Is noteworthy for integration: No
    Ticket Links:
        http://bugs.adobe.com/jira/browse/SDK-25689
    Modified Paths:
        flex/sdk/branches/4.x/frameworks/projects/spark/src/mx/core/FTETextField.as

    Delete and reinstall it.
    (104030)

  • How do I keep my texts from showing up on my daughter's macbook air?

    How do I keep my texts from showing  up on my daughter's MacBook air?
    jmacrdldn

    hello,
    go to iMessages on your daughters computer.
    in the top left go to messages and select preferences.
    in accounts tab. next to where it says your apple ID click sign out.
    this should resolve your query, please let me know how you get on.
    if you do not have access to your daughters computer I would suggest changing your apple ID password.

Maybe you are looking for

  • Logic idoc-xi-seibel customer extract

    Hi I have to work on a scenario where I have to send the customer extract to the seibel system. Here the source system is ECC and I have a custom idoc through which i have to send the cusomer extract to the Seibel system through XI. There should be a

  • 10.7 Bluetooth not working anymore

    I'm trying to setup my mighty mouse for the first time. It showed up in the bluetooth preferences but was not connecting, so I deleted it from the list and now, it doesn't show up anymore. I tried resetting the PRAM and SMC, dumping the bluetooth pre

  • Calling PL/SQL from JAVA

    Could someone please point this newbie to where I can find out how to call a PL/SQL procedure or function from JAVA. Thanks in advance.

  • C Library time functions don't work with WinCE 6.0

    Hello, in an WinCE 5 project I have used some time funtions (asctime(), time(), ...) from the C standard library. The functions are defined in the time.h file. Now I try to port the project to WinCE 6, but I don't have success with it, because the "t

  • Creating .bat for analyzing the Database.

    Hi Experts, I am having a doubt in scheduling database analysis process windows 2003 server. Every Sunday, we have to schedule the database analysis. just view the below example sysuser login id : testlogin sysuser password: demotest connection strin