T
T
TechNOIR2018-03-12 11:34:01
css
TechNOIR, 2018-03-12 11:34:01

PHP,HTML. How to implement this element for sorting goods?

Good afternoon.
I want to sort items by price in ascending and descending order.
Here is an interesting option like in Citylink
5aa63aea83afe145492314.jpeg
That is, once we click, the link is executed in ascending order and, accordingly, the triangle is up, once again we press in descending order and the triangle is down.
They did it with jQuery, but I'm interested in a simpler version.
How can this be done? Is this possible without JS?
Maybe there is some small example to understand the mechanism..
Thanks in advance!

Answer the question

In order to leave comments, you need to log in

3 answer(s)
A
Anton, 2018-03-12
@Eridani

They did it with jQuery, but I'm interested in a simpler version.

This is just the simplest option.
And so, pass a parameter in the GET link and catch it in the output template of these buttons. If there is a sortbyprice parameter, for example, add your own class, for example, .active

V
VladimirMelnik, 2018-03-12
@VladimirMelnik

Using JS in this case is the best option. Otherwise, a page reload will be required.
Here is the plugin: https://razorjack.net/quicksand/

P
Pavel Novikov, 2018-03-12
@paulfcdd

They did it with jQuery, but I'm interested in a simpler version.
where is it easier?) unless you ask users to change the position of the triangle in their imagination
not possible without JS. jQuery + AJAX will help you

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question