yberreby / TextShower

A lightweight JavaScript text slider.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Nested TextShower

2sbsbsb opened this issue · comments

Nested textShower - TextShower within textShower. It would be nice to have an enhancement to support "nested textShower".

Working currently-

A

A Desc

B

B Desc

C

C Desc

Enhancement-

A

a1

a1 Desc

a2

a2 Desc

a3

a3 Desc

B

B Desc

C

C Desc

Hello,

It would indeed be nice, I didn't notice this problem earlier.

However, I'm currently very busy, and I am not sure I will update this plugin soon.
If you want, though, you can try to fix this and make a pull request. Sorry for the inconvenience.

I got nesting to work on my own setup by changing the two lines

this.titleElement = $(box).find($('.TextShower-title'));
this.textElement = $(box).find($('.TextShower-text'));

to

this.titleElement = $(box).children(".TextShower-title");
this.textElement = $(box).children(".TextShower-text");

though this additionally required changing my html structure to have TextShower-title be a direct descendant of TextShower-box, e.g.

<div class="TextShower-box">
    <div class="TextShower-title">Title here.</div>
    <div class="TextShower-text">
        Text here.
    </div>
</div>

I have the first level of TS boxes styled separately as well, using CSS selectors with >, i.e.

body > .TextShower-box { }
body > .TextShower-box > .TextShower-title { }
body > .TextShower-box > .TextShower-text { }

Don't know if there's a better way, but it works for me.