Announcement

Collapse
No announcement yet.

Shorten Product Descriptions for Product Summmaries

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Shorten Product Descriptions for Product Summmaries

    If you use lengthy product descriptions but want to give those viewing your website a taste of the product decription in the Product Summary you can use an ellipsis that shortens the text and terminates it with three dots '...'

    Download jquery.dotdotdot.min.js from http://dotdotdot.frebsite.nl/download.php and save in the Site folder.

    Place this at the bottom of javascript header functions:

    Code:
    <script type="text/javascript" language="javascript" src="jquery.dotdotdot.min.js"></script>
    		<script type="text/javascript" language="javascript">
    			$(function() {
    				$('.dottybox').dotdotdot();				
    			});
    		</script>
    Add this to Current Stylesheet in Design view;

    Code:
    div.dottybox {
    	height: 40px;
    	overflow: hidden;
    	font-size: 14px;
    }
    Now in the Product Summary use:
    Code:
    	<div class="dottybox after">
    	<actinic:variable name="ProductDescription" />
    	</div>
    If you would like to try a simple stand alone example copy the following into a text editor and save it as an html file then view in a browser. The file needs to be saved in th same folder as jquery.dotdotdot.min.js

    Code:
    <!DOCTYPE html>
    <html>
    
    <head>
        <meta http-equiv="content-type" content="text/html;charset=iso-8859-1" />
        <meta name="author" content="www.frebsite.nl" />
    
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    
        <title>dotdotdot, advanced cross-browser ellipsis for multiple line content.</title>
    
        <script type="text/javascript" src="http://code.jquery.com/jquery-1.9.1.js"></script>
        <script type="text/javascript" language="javascript" src="jquery.dotdotdot.min.js"></script>
        <script type="text/javascript" language="javascript">
            $(function() {
                $('.dottybox').dotdotdot();
            });
        </script>
        <style type="text/css" media="all">
            html,
            body {
                padding: 0;
                margin: 0;
                height: 100%;
                width:100%;
            }
            
            body,
            div,
            p {
                font-family: Arial, Helvetica, Verdana;
                color: #333;
                -webkit-text-size-adjust: none;
            }
            
            body {
                background-color: #f3f3f3;
            }
            
            div.dottybox {
                height: 46px;
                overflow: hidden;
                font-size: 14px;
            }
        </style>
    </head>
    
    <body>
     <div style="width:500px;margin:0 auto;">
        <div class="dottybox after">
            <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo. Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos qui ratione voluptatem sequi nesciunt. Neque porro quisquam est, qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit, sed quia non numquam eius modi tempora incidunt ut labore et dolore magnam aliquam quaerat voluptatem. Ut enim ad minima veniam, quis nostrum exercitationem ullam corporis suscipit laboriosam, nisi ut aliquid ex ea commodi consequatur? Quis autem vel eum iure reprehenderit qui in ea voluptate velit esse quam nihil molestiae consequatur, vel illum qui dolorem eum fugiat quo voluptas nulla pariatur?"</p>
        </div>
     </div>
    </body>
    
    </html>
    Jonathan Chappell
    Website Designer
    SellerDeck Website Designer
    Actinic to SellerDeck upgrades
    Graphicz Limited - www.graphicz.co.uk
Working...
X