Find the way of thinking, how to use jQuery to realize the switching between list multi-modes

want to design an effect that can switch between text list, picture list, detailed list and so on. I saw similar video tutorials on the Internet before, but now I can"t find them.

I use simple .click () click events addClass () and .removeClass () to delete or add classes. Two styles can barely be implemented, while three styles are stupid. I feel too repetitive and impractical!

related codes

/ / Please paste the code text below (do not replace the code with pictures)
$("- sharpFolder") .click (function () {

  if(!$("-sharpwin-vod-list").hasClass("mdui-row-xs-9")){
       $("-sharpwin-vod-list").addClass("mdui-row-xs-9").removeClass("mdui-row-xs-1");
       $("-sharpwin-vod-list .list-video-thumb").removeClass("mdui-float-left");
       $("-sharpwin-vod-list .text-normal").removeClass("mdui-float-left");
       $("-sharpwin-vod-list .list-video-info").hide()};    

});

$("- sharpdetailed") .click (function () {
if (! $("- sharpwin-vod-list"). HasClass ("mdui-row-xs-1")) {

       $("-sharpwin-vod-list").addClass("mdui-row-xs-1").removeClass("mdui-row-xs-9");
       $("-sharpwin-vod-list .list-video-thumb").addClass("mdui-float-left");
       $("-sharpwin-vod-list .text-normal").addClass("mdui-float-left");
       $("-sharpwin-vod-list .list-video-info").show()}; 
 

});

$("- sharppic_thumb") .click (function () {

});

there is no more logical way?

Jul.17,2021

The styles of

two states are more suitable for classes. For the most common examples, such as show / hide, a .hide class is generally sufficient. For more than two states, it is recommended that you use custom attributes, such as

.
5</div>
</div>

var tabs=$("-sharptabs");
var content=$("-sharpcontent");
tabs.children().click(function(e){
    tabs.children().romveClass("active");
    content.children().hide();
    $(this).addClass("active");
    $("-sharp"+this.dataset.id).show();
});
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1e5504b-452f6.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1e5504b-452f6.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?