RishiShreshtha

ReadMore Script with More Flexibility

Feb 25th, 2013
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. jQuery(document).ready(function() {
  2.     jQuery(".readmore").each(function() {
  3.         var loc = window.location.pathname;
  4.         // Only for HomePage since the URLs of HomePage in Kentico can be from any of these three
  5.         if ((loc == '/Home.aspx') || (loc == '/Default.aspx') || (loc == '/')) {
  6.             jQuery('div.readmore').expander({
  7.                 slicePoint: 959,
  8.                 expandSpeed: 1000,
  9.                 collapseSpeed: 1000,
  10.                 expandPrefix: ' ',
  11.                 expandText: ' Read More +',
  12.                 userCollapseText: ' Hide Text -'
  13.             });
  14.         // Only for a Specific InnerPage, these pages can be any page from the enitre site, this can also be used for more than one page just define the "else if" code once again and replace the "loc" parameter with the required one
  15.         } else if (loc == '/Floor-plans.aspx') {
  16.             jQuery('div.readmore').expander({
  17.                 slicePoint: 570,
  18.                 expandSpeed: 1000,
  19.                 collapseSpeed: 1000,
  20.                 expandPrefix: ' ',
  21.                 expandText: ' Read More +',
  22.                 userCollapseText: ' Hide Text -'
  23.             });
  24.         // For All Pages except the above mentioned
  25.         } else {
  26.             jQuery('div.readmore').expander({
  27.                 slicePoint: 600,
  28.                 expandSpeed: 1000,
  29.                 collapseSpeed: 1000,
  30.                 expandPrefix: ' ',
  31.                 expandText: ' Read More +',
  32.                 userCollapseText: ' Hide Text -'
  33.             });
  34.         }
  35.     });
  36. });
Advertisement
Add Comment
Please, Sign In to add comment