Jump to content

UIKIT and renderPager()


bernhard
 Share

Recommended Posts

i really like uikit framework and it has a nice looking pagination component: http://getuikit.com/docs/pagination.html

creating the pager markup is a little bit tricky and i've only managed it with a little jquery hack. the problem is that the "active" item needs a <span> without an <a> and that's not possible with the built in renderPager()

2016-07-21 21_54_35-Pagination component - UIkit documentation.png

to save anybody needing uikit pager some time, here are the options:

<?php
echo $items->renderPager(array(
    'numPageLinks' => 5,
    'listMarkup' => "<ul class='uk-pagination'>{out}</ul>",
    'itemMarkup' => "<li class='{class}'>{out}</li>",
    'linkMarkup' => "<a href='{url}'>{out}</a>",
    'nextItemLabel' => '<i class="uk-icon-angle-double-right"></i>',
    'previousItemLabel' => '<i class="uk-icon-angle-double-left"></i>',
    'separatorItemLabel' => '<span>...</span>',
    'currentItemClass' => 'uk-active',
    ));

and then you need this line of jquery to remove the <a> from the active item:

$('li.uk-active > a > span').unwrap();

or do you guys have any better solutions for this?

happy paginating ;)

  • Like 1
Link to comment
Share on other sites

Why not take the uikit style from the <span>  and add it to the <a>?

.uk-pagination>.uk-active>a {
    background: #009dd8;
    color: #fff;
    border: 1px solid rgba(0,0,0,.2);
    border-bottom-color: rgba(0,0,0,.4);
    background-origin: border-box;
    background-image: -webkit-linear-gradient(top,#00b4f5,#008dc5);
    background-image: linear-gradient(to bottom,#00b4f5,#008dc5);
    text-shadow: 0 -1px 0 rgba(0,0,0,.2);
}

 

  • Like 1
Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...