kswedberg / jquery-expander

Expand and Collapse HTML content

Home Page:https://kswedberg.github.io/jquery-expander/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

chio

xaxiao opened this issue · comments

there was a weird problem.
i have a very simple html code:

  <html>
    <head>
      <title>Test</title>
      <script type="text/javascript" src="file://C:/projekte/js/query-1.8.2.min.js"></script>
      <script type="text/javascript" src="file://C:/projekte/js/query-ui.js"></script>
      <script type="text/javascript" src="file://C:/projekte/js/query.expander.js"></script>
    </head>
    <body style="min-width: 600px;max-width: 1200px;">

      <div id="textblock_d2643e6" class="expandabletext">
        <div>asd fas kdf ajs dfa s
  asl kfjl asjd
  a a zweite Zeile.....
  asaklfjasdf
  pageheaderfasfasfasf
  fsdgf
          </div>
      </div>
      <script type="text/javascript">    
          jQuery(document).ready(function() {
              jQuery('.expandabletext').expander({
                  slicePoint:       60,            // default is 100
                  expandText:       'more',        // default is 'read more'
                  userCollapseText: '[...]', // default is 'read less'
                  expandEffect:     'slideDown',
                  collapseEffect:   'slideUp'
              });     
          });
      </script>
    </body>
  </html>

The expander didn't work.
but if i insert a space between 'a' and 'k' in forth row.
then the expander works fine.
why? can somebody explain it.thanks

The problem here is that the default widow option (4) is too high for your needs. In other words, the "detail" part, which ends up being asaklfjasdf
pageheaderfasfasfasf
fsdgf,
has fewer than 4 words. Try setting it to 0 or 1 and it should work as you expect.