Silex
Silex copied to clipboard
Using Anchors
I'm pretty sure I'm close to figuring this out but still not positive.
From what I've gathered you have to use an HTML container, format your text with <a>anchor</a>
and then in the link instead of doing #!page-PAGENAME you'd do #ANCHORNAME
However, this doesn't seem to work
Is it something more like #!page-PAGENAME#ANCHORNAME?
Thanks
The second solution is supposed to work, with page name and anchor
Is this solved @Tyrael84 ?
I can't seem to get it to work.
<a name="air-movers"><b><font size="7"><center><font color="#6FA8DC">Air Movers</font></center></font></b></a>
Is on the desired page.
For the link #!page-air-movers#air-movers
Doesn't seem to work.
@lexoyo Any ideas, Alex?
Thanks!
I'm so sorry I will look at this soon If someone knows a little bit of javascript and want to help, please tell me and I will give you instructions
Ok, I finally looked into it It was more complicated than I thought. I think that it used to work but it does not anymore Here is a code you can paste in the "JS editor" of your site and what you did will work
$(function() {
function checkAnchor() {
var anchorName = window.location.hash.substr(window.location.hash.lastIndexOf('#') + 1);
if(anchorName !== '' && anchorName.indexOf('!page-') < 0) {
// there is an anchor
var target = $('a[name=' + anchorName + ']').get(0) || $('a[id=' + anchorName + ']').get(0);
$('html, body').animate({
scrollTop: $(target).offset().top
}, 2000);
}
}
// this will be executed when the page is loaded
var current = $('body').pageable('option').currentPage;
$('body').addClass(current + '-opened');
$('body').on('pageChanged', function (event, pageName) {
checkAnchor();
});
checkAnchor()
});
Please feel free to ask questions about the code. I used this doc to create it
- silex doc, see the "Page events" section https://github.com/silexlabs/Silex/issues/200
- jquery doc https://stackoverflow.com/questions/6677035/jquery-scroll-to-element
Thank-you @lexoyo!
I haven't used silex in a few days and now all of my 522 saved revisions of my site seem to be broken and only showing the header. All of the content is missing and the footer so once I figure out what's going on I'll make sure to let you know if it worked!
I would refresh and try again... And open the page panel and click on the first page
@lexoyo
Well, this is a little terrifying but nothing seems to work. My only guess is that I need to load it up on the real Silex Editor and not the pre-pod one. The only problem is -- dropbox still does not work on the original Silex Editor. :(
please share it with me on dropbox (a.hoyau at im-paris.fr)
Okay bare with me I haven't used DropBox to share files in a while. I created a new folder and I believe I gave you priviledges to view it. Inside are the assets, scripts, css, and the 522th revision of the website (.html).
Right now the 522th revision opens fine on my computer but when I try to load it up on Silex only the header seems to be visible. The footer and all the content seems to be invisible. Unsure why.
Thanks,
Nick.
Hey Alex I'm sure you're busy but figured I'd send you a quick message to see if you have any idea what happened to my site?
When I load up the HTML itself in a browser all the content is still there and working. When I open it up on prepod.silex.me all the content and the footer is gone.
hi @Tyrael84 i finally looked at what you shared, sorry for the long delay, we lack contributors for so many things that i had no time for support...
in you html page "index522.html", i see only content on the page "fire-smoke-damage", and no footer. maybe you deleted the rest by accident?
you can still retrieve a previous version of the site right? did you know you can open a site, copy some elements, then open another site and paste those elements? this could be useful to you
oh and by the way, your site looks great! I would love it even more if it was a bit smaller:
like this:
instead of this: