Cutter.js

Truncate HTML

Cutter.js API

Cutter.run( oApplyTo, oTarget, nWords, oTexts, oClasses )

Executes the cutter on oApplyTo and put the content cut in oTarget.

Params:
  • oApplyTo : DOM element to cut the content.
  • oTarget : DOM element where put the content after cut.
  • nWords : Number of words to cut on the oApplyTo element.
  • oTexts : Config object for the text in the link, to show the full content again, if it's needed.
    • oTexts by default.

      											
        {
          more: "View more"
        }
      											
      										


  • oClasses : Config object for the style class to apply the link, to show the full content again, if it's needed.
    • oClasses by default.

      											
        {
          more: "more"
        }
      											
      										

Go UP

Examples

Cutter:

Run cutter on "test":
                    	
	var oElement = document.getElementById("test");
	Cutter.run(oElement, oElement, 100);
                    	
                    	
Go UP

Cutter.js License:

Cutter.js is licensed under the MIT license.

						
	Copyright (c) 2011 Tomás Corral Casas

	Permission is hereby granted, free of charge, to any person obtaining a copy of this software
	and associated documentation files (the "Software"), to deal in the Software without
	restriction, including without limitation the rights to use, copy, modify, merge, publish,
	distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the
	Software is furnished to do so, subject to the following conditions:

	The above copyright notice and this permission notice shall be included in all copies or
	substantial portions of the Software.

	THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
	BUT NOT LIMITED	TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
	NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE	LIABLE FOR ANY CLAIM,
	DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF	CONTRACT, TORT OR OTHERWISE, ARISING FROM,
	OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
						
                   		
Go UP
Fork me on GitHub