pravid
pravid

Reputation: 729

issue with multiline text with ellipsis in chrome

I'm stuck with some weird issue and hope I can get some help here.

I have a multi-line text inside anchor tag which is surrounded by span and then by div tag. I have added plugin 'dotdotdot' to add ellipsis to this text. It works fine in Firefox but in chrome it removes anchor tag completely.

Here is the jsfiddle link I have created for testing https://jsfiddle.net/trupti11/0p7jf56m/6/

Resize the output window width to mobile size (around 360px or less) and you can see the text disappear.

What could be the issue?

Here is the sample code

Html

<div class="wallTopBar" style="width:100%;">
        <img class="b2l_border_img" alt="" src="" style="display: block;" width="auto" height="auto">
            <div class="wallTitle" style="display: block; overflow-wrap: break-word;"><span class="wallTitleBox"><a href=" http://www.google.com " target="_blank">Testing for really really long long long, very looonnggg booklist name</a></span></div>
            <div class="embedButton" style="display: block;">
                <span style="display: none;">Embed Code</span>
                <img src="" width="35px" height="35px">
            </div>
        <div class="dummyDesc" style="display: none;"></div></div>

Javascript

$(document).ready(function() {
$(".wallTitle").dotdotdot({
        ellipsis: '... ',
        watch: "window",
        wrap    : 'word',
        fallbackToLetter: true
    });
});

CSS

.wallTopBar {
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.2);
    margin: auto; padding: 0; position: fixed; top: 0; z-index: 10;
}

.b2l_border_img {
     height: 4px;margin: auto;width: 100%;background-color:#ccc;
}

.wallTitle { margin-right: 60px; }
.wallTitle {
    font-family: opensans-bold,Arial,Helvetica,sans-serif;
    font-size: 18px; max-height: 60px; overflow: hidden;
    padding-top: 0; position: relative;
}

.wallTitle span {
    display: table; height: 46px; margin: 4px auto;
    overflow: hidden; width: 98%;
}
.wallTitleBox {
    border: 1px solid #cccccc; box-shadow: 3px 1px 5px #cccccc;
}

.wallTitle a {
    display: table-cell;padding: 1px;vertical-align: middle;
    text-decoration:none;
}

.embedButton {
    border-radius: 6px; height: 35px;margin: 12px 8px;
    position: absolute;right: 0;top: 4px;
}

.embedButton img { background-color:#ccc; }

Thanks for any help.

Upvotes: 0

Views: 375

Answers (1)

Mr.7
Mr.7

Reputation: 2713

Try removing onverflow: hideen to .wallTitle span.

Working fiddle

$(document).ready(function() {
$(".wallTitle").dotdotdot({
		ellipsis: '... ',
		watch: "window",
		wrap	: 'word',
		fallbackToLetter: true
	});
});
.wallTopBar {
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.2);
    margin: auto;
    padding: 0;
    position: fixed;
    top: 0;
    z-index: 10;
}

.b2l_border_img {
    height: 4px;
    margin: auto;
    width: 100%;
background-color:#ccc;
}

.wallTitle {
    margin-right: 60px;
}
.wallTitle {
    font-family: opensans-bold,Arial,Helvetica,sans-serif;
    font-size: 18px;
    max-height: 60px;
    overflow: hidden;
    padding-top: 0;
    position: relative;
}

.wallTitle span {
    display: table;
    height: 46px;
    margin: 4px auto;
    x-overflow: hidden;
    width: 98%;
}
.wallTitleBox {
    border: 1px solid #cccccc;
    box-shadow: 3px 1px 5px #cccccc;
}

.wallTitle a {
    display: table-cell;
    padding: 1px;
    vertical-align: middle;
text-decoration:none;
}

.embedButton {
    border-radius: 6px;
    height: 35px;
    margin: 12px 8px;
    position: absolute;
    right: 0;
    top: 4px;
}

.embedButton img {
background-color:#ccc;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script src="https://book2look.com/javascript/jquery.dotdotdot.min.js"></script>

<div class="wallTopBar" style="width:100%;">
  <img class="b2l_border_img" alt="" src="" style="display: block;" width="auto" height="auto">
  <div class="wallTitle" style="display: block; overflow-wrap: break-word;"><span class="wallTitleBox"><a href=" http://www.google.com " target="_blank">Testing for really really long long long, very looonnggg booklist name</a></span></div>
  <div class="embedButton" style="display: block;">
    <span style="display: none;">Embed Code</span>
    <img src="" width="35px" height="35px">
  </div>
  <div class="dummyDesc" style="display: none;"></div></div>

Hope this helps :)

Upvotes: 1

Related Questions