ElkArte Community

Extending Elk => Addons => Addons ideas and questions => Topic started by: ahrasis on July 27, 2016, 07:54:50 am

Title: Linktree In Mobile View
Post by: ahrasis on July 27, 2016, 07:54:50 am
I can't find the topic where somebody is asking to change the look of linktree in mobile view as I am now interested to look into it.

If I remember correctly, the suggestion is to make it something like this format:

Home
-| First
--| Second
---|Third
----| Fourth

I think this could be done by hiding default linktree and showing mobile linktree in mobile view.

I will also attempt to create this addon (with other addons), soon.
Title: Re: Linktree In Mobile View
Post by: emanuele on July 27, 2016, 08:32:16 am
Honestly, I would remove the linktree entirely (at least one of the two).
To obtain something like the one you describe, you can just use some css: display:block; width:100% and then adjust the padding with nth-child(1/2/3/4/etc) (you set for example 4em on .linktree, and then nth-child(1) 0.75em, nth-child(2) 2em, nth-child(3) 3em, and you can stop there IMO).
And finally:
Code: [Select]
.linktree:before {
    content: "-|";
    float: left;
}
.linktree:nth-child(3):before {
    content: "-----|";
    margin-left: -2.25em;
}
.linktree:nth-child(2):before {
    content: "--|";
    margin-left: -1.25em;
}
It may require some adjustment, but should work. :)
Title: Re: Linktree In Mobile View
Post by: meetdilip on July 27, 2016, 08:47:58 am
Google likes linktree / breadcrumbs.
Title: Re: Linktree In Mobile View
Post by: emanuele on July 27, 2016, 09:28:07 am
Reference?
Title: Re: Linktree In Mobile View
Post by: meetdilip on July 27, 2016, 10:08:20 am
I do not have the link right now. I think it was under the guidelines for a website to be mobile friendly.
Title: Re: Linktree In Mobile View
Post by: ahrasis on July 27, 2016, 11:08:59 am
Quote from: emanuele – Honestly, I would remove the linktree entirely (at least one of the two).
To obtain something like the one you describe, you can just use some css: display:block; width:100% and then adjust the padding with nth-child(1/2/3/4/etc) (you set for example 4em on .linktree, and then nth-child(1) 0.75em, nth-child(2) 2em, nth-child(3) 3em, and you can stop there IMO).
And finally:
Code: [Select]
.linktree:before {
    content: "-|";
    float: left;
}
.linktree:nth-child(3):before {
    content: "-----|";
    margin-left: -2.25em;
}
.linktree:nth-child(2):before {
    content: "--|";
    margin-left: -1.25em;
}
It may require some adjustment, but should work. :)
I will test this and update later.
Title: Re: Linktree In Mobile View
Post by: ahrasis on August 01, 2016, 09:38:42 pm
So far I tested the following css to modify the linktree in mobile view for screen below 50em. Those who aimed at smaller screen of 33.75 or below may use @media screen and (max-width: 33.75em) instead.

Code: [Select]
@media screen and (max-width: 50em) {

ul.navigate_section li:not(:first-child):not(:last-child) a {
overflow: visible;
}
.linktree, .linktree:after {
float: none;
display: block;
padding: 0;
border: none;
box-shadow: none;
}
.linktree:not(:first-child) {
margin: 1em 0 0;
}
.linktree:first-child a {
height: 2em;
padding: 0 2px;
}
.linktree, .linktree:last-child, .linktree:last-child a, .linktree:last-child>spa, .linktree:nth-child {
width: 100%;
max-width: 100%;
}
.linktree:nth-child(2):before {
content: "\00a0 \00a0 -> \00a0";
float: left;
}
.linktree:nth-child(3):before {
content: "\00a0 \00a0 ---> \00a0";
float: left;
}
.linktree:nth-child(4):before {
content: "\00a0 \00a0 -----> \00a0";
float: left;
}
.linktree:nth-child(5):before {
content: "\00a0 \00a0 -------> \00a0";
float: left;
}
}
I am not so sure whether we need addon for this but do feel free to contribute more ideas for this in here.