I read earlier that you couldnt make the blocks be collapsed as default¨, but say I got a friend who actually made that work - Now, is there any possibility to add a script that auto expands the block when you mousover the title, (the only visible thing when block is collapsed) and then autocollapse the block when you mouseout again?
I myself would consider this one of those things maybe nice to have, but not needed... The only sanario I can see this being useful is for mobile devices, that I think I mention once before. But at this time there are some working with this type theme/s I don't believe there are any that are ready for them att>?<
Another thing you do not always need to make so many main categories, You can create like one/two and have the others under it, and then Child board/s under those. This will limit the amount of Cat title bars.
I have been working hard on clean themes with less bars and image> and this maybe something Myself or a themer may be able to do I may look into this, but for the portal TP, is just fine for me!
JMHO
regards,
Maxx
I didn't mean the forum categorys themselves, but I meant the php block that I have on my sidepanel
What would be cool was a javascript that had them collapsed as default upon entering the site and then a mouseover/mouseout effect to show/hide content.
Here's the site www.sacrilegeguild.com
You can do that with javascript pretty easily. I don't have time to code the thing for you but try playing around with this example I wrote. Copy & paste it into a new HTML file and just open it on your desktop. It should get you started.
<html>
<div id="someelement" onmouseover="showDiv('hidden');" onmouseout="hideDiv('hidden');">Hover Here
<div id="hidden" style="display: none; height: 150px; width: 400px; background: #ccc">
Eam eu oratio possim moderatius. Per at electram maluisset abhorreant, enim inciderint et vel. An partem docendi vel. Per graeco omnesque euripidis ex, mea no ubique facilisis voluptaria. Suavitate reformidans qui ut. Eos cu choro deserunt, vis admodum singulis pertinacia in. Id vidisse argumentum qui, vis nulla postea ceteros at. Ea sea erant consulatu.
</div>
</div>
<div>
Some other content here...
</div>
<script language="javascript" type="text/javascript">
function showDiv(id) {
document.getElementById(id).style.display = "compact";
}
function hideDiv(id) {
document.getElementById(id).style.display = "none";
}
</script>
</html>
I can make that script working in a html/javascript block a textmodifer to show/hide (hover here) - BUT that is not exactly what I'm looking for.
I've attached 2 screenshots so you can see what I plan on doing.
The first problem is that the content that's inside the block is a php script and it has to be saved in a php block. It does not work in a HTML block.
The second problem is that I want the block to be collapsed by default when you first enter the site (when people expand/collapse it gets stored in their cache, but I need the block to be forced to be collapsed upon the first visit)
What I want then is to view only the title bar / header text and onmouseover use the expand option, then on mouseout use the collapse option.
Onmouseout - http://i49.tinypic.com/2coflao.png
Onmouseover - http://i47.tinypic.com/wtggpd.png
Well you can add attributes on the fly, but you need some way to hook into the layout. The title bar of the blocks do not have an id attribute, so you cannot pop any new attributes in there as far as I can see.
If the title of the block had an id it could be done, but alas not....I will think on it some more, but I don't think there is a way without modifying TP.
This is the closest I can get. It hides the block content on page load. After that the only way to see it is by hovering over the expand/collapse button - because this is the only element that has an id I can hook in to.
This is used on block11 as it is the one you have on your site. Try it out on some fresh block first maybe, but don't forget to change the block numbers...block11 x 3 and blockcollapse11...
echo '
<script language="javascript" type="text/javascript">
hideElement(\'block11\');
addAttributes("blockcollapse11");
function addAttributes(id) {
document.getElementById(id).setAttribute("onmouseover", "showElement(\'block11\');");
document.getElementById(id).setAttribute("onmouseout", "hideElement(\'block11\');");
}
function showElement(id) {
document.getElementById(id).style.display = "compact";
}
function hideElement(id) {
document.getElementById(id).style.display = "none";
}
</script>';
echo 'Some text content or something else here....';
Thanks bud, I'm able to put this to good use.
I was really hoping to be able to use the title.bar as an Id for expand/collapse, but I see that you are right regarding it have to be bound to an ID.
I did try a little workaround though. I centered the expand/collapse images onto the middle of the block, then I made them transparant and increased their height and width for a temp. fix. It seemed good at first, but unfortunately the text written on the titlebar below was not visible through the transparant picture, only the block itself :p
Thanks anyways. I'm quite happy now that the blocks are autocollapsed upon visit.
Good, well at least we got you some of the way :)
Interesting how that works Freddy. I know you've been studying up on your javascript so good job on that. O0 I looked at the right panel on Aqualung's site --> http://www.sacrilegeguild.com/
I tried hovering over the down arrow to the right of the top one (World Bosses) using FireFox and it wouldn't expand. I had to click the arrow to make it expand. Moving the mouse off of the arrow though did indeed make it collapse. Is that how it is supposed to work?
Aqualung, any chance that you could post the code you are using for that one (World Bosses) using the code tags here (#)? I'd like to see how that works. I'm still confused on how you were able to do that though. Did you guys have to edit any of the core TP code to get this to work?
ZarPrime
Well spotted ZP, yes that was not working. It appears FF (and maybe IE) have a problem with the 'compact' display style.
Change this :
function showDiv(id) {
document.getElementById(id).style.display = "compact";
}
To this...
function showDiv(id) {
document.getElementById(id).style.display = "block";
}
ZP, no source code is edited in TP. It's just on-the-fly javascript. It finds the img (collapse image) element via it's 'id'. Once you have the id it can add some javascript to it. The javascript then hides or shows the associated block (again found via it's 'id'). Hope that makes sense.
The next version of TP is shipping with jquery. I'd suggest looking into it to do these things as jquery makes things very simple. Turn that function into this with jquery.
function showDiv(id) {
$(id).show();
}
To hide it:
function hideDiv(id) {
$(id).hide();
}
Yeah I use prototype a lot and it also has that kind of thing. Makes coding a lot easier...less key strokes ;)
Quote from: Freddy on June 11, 2012, 01:06:46 PM
ZP, no source code is edited in TP. It's just on-the-fly javascript. It finds the img (collapse image) element via it's 'id'. Once you have the id it can add some javascript to it. The javascript then hides or shows the associated block (again found via it's 'id'). Hope that makes sense.
Ahhh, got it. I understand now. O0 Changing "compact" to "block" made it work right so that is cool. So this is basically only useful if someone has something they only want to display but not interact with (like links in the block) since the block collapses when you mouseout. ;)
Thanks Freddy.
ZP
No problem :) Yeah only useful for plain information and not things like links in this way.