solved Adding a Slider with Left and Right Arrows

Dazed
Dazed
@dazed
2 years ago
1,022 posts
Before I do something custom I wanted to see if there is an easy way in JR to do sliders with arrows?

I am displaying the most recent uploads in a row and it is limited to 8. I would like to put it into a slider and have left and right arrows so users can scroll easily and see the top 25 for example.

I am using audio pro.

Thanks!
updated by @dazed: 04/17/22 02:15:16PM
michael
@michael
2 years ago
7,692 posts
depends on how you like to develop. If you're using the "Site Builder" system, it has an image rotator (no arrows though) that cycles through the images with a number picker on the bottom.

I get the feeling you're wanting to jump sections of HTML code rather than images though.

If that's the case the steps I'd take would be to locate an example of what you're wanting to do and copy it. It's probably done with a jQuery library anyhow, so once you locate the example then you can figure out what library is being used then follow its docs. Would be the first steps I'd think to take.
auto.png
auto.png  •  751KB

Dazed
Dazed
@dazed
2 years ago
1,022 posts
Hey Michael:

Here is one of the examples...

https://splidejs.com/ - look at the multiple slider a few rows down.

Currently this is what is displayed. I just want the ability for the same code to be used and then the user can arrow right to see the next 8.
mix.png
mix.png  •  175KB

nate
@nate
2 years ago
911 posts
iSkin did something like that.
douglas
@douglas
2 years ago
2,767 posts
MediaPro has one as well.


--

Douglas Hackney
Jamroom Team - Designer/Developer/Support
FAQ-Docs-Help Videos
Dazed
Dazed
@dazed
2 years ago
1,022 posts
Thanks for the help all. I have this working but I think there is some cleanup that can be done. I removed the call to the New Artist from Media Pro which worked. But at the top I should only need one foreach loop. How should that look so that there is only one loop? Between the "row" and the "rank" I could not get it to resolve.

ex: https://mixposure.com/index1


{* ROW TEMPLATE *}
{capture name="row_template" assign="new_song_template"}
{literal}


{if isset($_items)}
<div class="container">
    {foreach from=$_items item="row"}
    {if $row@first || ($row@iteration % 8) == 1}
    <div class="row">
    {/if}
        <div class="col2{if $row@last || ($row@iteration % 8) == 0} last{/if}">
            <div class="center" style="padding:10px;">
			
			//old code was here
			
				
				
            </div>
        </div>
    {if $row@last || ($row@iteration % 8) == 0}
    </div>
    {/if}
    {/foreach}
</div>





{if isset($_items)}
    {jrCore_module_url module="jrAudio" assign="murl"}
    {$rank = 0}
    {foreach from=$_items item="item"}
        {$rank = $rank+1}
        {if $rank%8 == 1}
            <div class="row">
        {/if}

        {if strlen($item.audio_title) > 0}
            <div class="index_item">
                <div class="wrap">
                    <div class="image">
                        <a href="{$jamroom_url}/{$item.profile_url}/{$murl}/{$item._item_id}/{$item.audio_title_url}"> 
                            {jrCore_module_function
                            function="jrImage_display"
                            module="jrAudio"
                            type="audio_image"
                            item_id=$item._item_id
                            size="medium"
                            crop="auto"
                            class="iloutline img_shadow img_scale"
                            alt=$item.audio_title
							style="max-width:190px;"
                            width=false
                            height=false
                            }</a>
                    </div>
                    <span class="item_title">{$item.audio_title|truncate:20}</span>
                    <span>{jrCore_lang skin="MixAP" id="34" default="By"} {$item.profile_name}</span>
                    <span>Album: {$item.audio_album|truncate:20}</span>
                    <span>Genre: {$item.audio_genre}</span>
                    <ul class="index_buttons">
                        <li>{if $item.audio_active == 'on' && $item.audio_file_extension == 'mp3'}
                                {jrCore_media_player type="jrAudio_button" module="jrAudio" field="audio_file" item=$item}
                            {/if}
							
                        </li>
                        <li>
                            {jrCore_module_function function="jrFoxyCart_add_to_cart" module="jrAudio" field="audio_file" item=$item}
                        </li>
                        <li>
						{jrLike_button item=$item module="jrAudio" action="like" item_id=$item._item_id}</li>
                    </ul>
                </div>
            </div>
        {else}
            <div class="index_item">
                <div class="wrap">
                    <div class="image">
                        <a href="{$jamroom_url}/{$item.profile_url}/{$murl}/{$item._item_id}/{$item.soundcloud_title_url}">
                            <img class="img_scale" src="{$item.soundcloud_artwork_url}">
                        </a>
                    </div>
                    <span class="item_title">{$item.soundcloud_title|truncate:20}</span>
                    <span>{jrCore_lang skin="MixAP" id="34" default="by"} {$item.profile_name}</span>
                    <span>{$item.soundcloud_artist|truncate:20}</span>
                    <span>{$item.soundcloud_genre}</span>
                    <ul class="index_buttons">
                        <li>
                            {jrSoundCloud_player params=$item}
                        </li>

                        <li>{jrLike_button item=$item module="jrSoundCloud" action="like" item_id=$item._item_id}</li>
                    </ul>
                </div>
            </div>
        {/if}

        {if $rank%8 == 0 || $rank == $info.total_items}
            </div>
        {/if}

    {/foreach}
{else}
    <div class="no-items">
        <h1>{jrCore_lang skin="MixAP" id="62" default="No items found"}</h1>
        {jrCore_module_url module="jrCore" assign="core_url"}
        {if $_conf.MixAP_require_price == 'on'}
            {jrCore_lang skin="MixAP" id="63" default="This list currently requires items to have a price set."}
        {/if}
        <button class="form_button" style="display: block; margin: 2em auto;" onclick="jrCore_window_location('{$jamroom_url}/{$core_url}/skin_admin/global/skin={$_conf.jrCore_active_skin}/section=List+1')">{jrCore_lang skin="MixAP" id="64" default="Edit Configuration"}</button>
    </div>
{/if}







{if $info.total_pages > 1}
<div style="float:left; padding-top:9px;padding-bottom:9px;">
    {if $info.prev_page > 0}
    <span class="button-arrow-previous" onclick="jrLoad('#newest_artists','{$info.page_base_url}/p={$info.prev_page}');$('html, body').animate({ scrollTop: $('#newsongs').offset().top -100 }, 'slow');return false;">&nbsp;</span>
    {else}
    <span class="button-arrow-previous-off">&nbsp;</span>
    {/if}
    {if $info.next_page > 1}
    <span class="button-arrow-next" onclick="jrLoad('#newest_artists','{$info.page_base_url}/p={$info.next_page}');$('html, body').animate({ scrollTop: $('#newsongs').offset().top -100 }, 'slow');return false;">&nbsp;</span>
    {else}
    <span class="button-arrow-next-off">&nbsp;</span>
    {/if}
</div>
{/if}


<div class="clear"> </div>
{/if}
{/literal}
{/capture}


{if isset($_conf.MixAP_require_images) && $_conf.MixAP_require_images == 'on'}
    {jrCore_list module="jrAudio" order_by="_created desc" limit="64" group_by="_profile_id UNIQUE" template=$new_song_template require_image="profile_image" pagebreak="8" page=$_post.p}
{else}
    {jrCore_list module="jrAudio" order_by="_created desc" limit="64" group_by="_profile_id UNIQUE" template=$new_song_template require_image="profile_image" pagebreak="8" page=$_post.p}
{/if}

douglas
@douglas
2 years ago
2,767 posts
Your code is a little confusing.

Can you email us the URL and admin login so I can check it out in action, it might give me a better idea on what your trying to accomplish and how to go about it.

Thanks!


--

Douglas Hackney
Jamroom Team - Designer/Developer/Support
FAQ-Docs-Help Videos
Dazed
Dazed
@dazed
2 years ago
1,022 posts
douglas:
Your code is a little confusing.

Uh that is JR code lol. That is just a copy and paste. It confused me also so that is what prompted the post. I will create a ticket for it.
douglas
@douglas
2 years ago
2,767 posts
Gotcha, should be fixed now.


--

Douglas Hackney
Jamroom Team - Designer/Developer/Support
FAQ-Docs-Help Videos