Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Pages: 1
Switch form for even or odd articles
Is there a solution or a plug-in to simply switch form rendering between even or odd results?
Something like:
<txp:if_even> Form with even id or class </txp:if_else /> Form with odd id or class </txp:if_even>
Thanks!
Offline
Re: Switch form for even or odd articles
Try the zem_nth plugin.
Offline
Re: Switch form for even or odd articles
Thanks ruud!!!
I’ve found also two TxpTips solutions for do that in zem_nth topic
Last edited by wornout (2010-08-02 15:14:31)
Offline
Re: Switch form for even or odd articles
You can also use JQuery:
For example if all your results are inside <ol id="results">
and each result is contained inside a <li>
you can put the following in your <head>
;-)
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js"></script> <script type="text/javascript" > $(document).ready(function() { $('#results li:even').addClass('even'); }); </script>
Then you can style #results li.even {}
using CSS
Last edited by maniar (2010-08-02 15:48:07)
اردو میں بھی دستیاب Textpattern آپ کے لیے اب
Offline
Re: Switch form for even or odd articles
Or CSS’ nth pseudos.
li:nth-child(even) {
background: #000;
}
Which also can be used in conjuction with the JavaScript solutions to give those that don’t have JavaScript support same styles.
Offline
Re: Switch form for even or odd articles
Of course jQuery and CSS are good solutions for styling. I’m searching for a method that let me render different structures of html. So zem_nth is the best start point.
Offline
Pages: 1