Whale slider evolution

Permalink Browser Info Environment
Hello, I need an extra option on the Whale Gallery.
I need a random display feature.
Can you give me a solution?
Thank you

Type: Pre-Sale
Status: Resolved
Elstud
View Replies:
shahroq replied on at Permalink Reply
shahroq
Hi,
The js plugin used in the "Whale Slider" block does not have any option for random slides. Yet it should be possible to shuffle slides out of plugin's code domain. I wrote something like this and it seems working, though I didn't test it scrupulously. You can clone default "Whale Slider" template and append the code at the end of the template.
<script type="text/javascript">
$(document).ready(function() {
    $.fn.shuffle = function() {
        var allElems = this.get(),
            getRandom = function(max) {
                return Math.floor(Math.random() * max);
            },
            shuffled = $.map(allElems, function(){
                var random = getRandom(allElems.length),
                    randEl = $(allElems[random]).clone(true)[0];
                allElems.splice(random, 1);
                return randEl;
           });
        this.each(function(i){
            $(this).replaceWith($(shuffled[i]));
Elstud replied on at Permalink Reply
Elstud
Great !
Thank you, I will try next week and I give you my feedback.
Elstud replied on at Permalink Reply
Elstud
Well, I test it, but nothing happen..

I put this script at the end of view.php in "whale_image_slider"

That's it ? no ?
shahroq replied on at Permalink Reply
shahroq
Could you send me the link where the code has been added?
shahroq replied on at Permalink Reply
shahroq
Hi Jeff,
As I see, now that the code is added, the slider displays slides in random order. Open the page in multiple tabs and compare the order.
Elstud replied on at Permalink Reply
Elstud
unbelievable !!
I did not see him !!
I work too late ...
Thank you, it's just perfect!
Elstud replied on at Permalink Reply
Elstud
I did not see it because I had a cache problem. By purging the cache, it works much better !!
shahroq replied on at Permalink Reply
shahroq
Happy to hear it all worked out.
Cheers,

concrete5 Environment Information

# concrete5 Version
Core Version - 8.4.0RC1
Version Installed - 8.4.0RC1
Database Version - 20180330080830

# concrete5 Packages
Pixel Theme (2.0.3), Simple Gallery (1.0.7), Whale Grid Gallery (2.4.5)

# concrete5 Overrides
css/file-manager.css

# concrete5 Cache Settings
Block Cache - On
Overrides Cache - On
Full Page Caching - Off
Full Page Cache Lifetime - Every 6 hours (default setting).

# Server Software
Apache/2.2

# Server API
cgi-fcgi

# PHP Version
7.1.21

# PHP Extensions
cgi-fcgi, Core, ctype, curl, date, dom, fileinfo, filter, gd, gettext, hash, iconv, json, libxml, mbstring, mcrypt, mysqli, mysqlnd, openssl, pcre, PDO, pdo_mysql, pdo_pgsql, pgsql, Phar, posix, readline, Reflection, session, shmop, SimpleXML, SPL, standard, sysvmsg, sysvsem, sysvshm, tokenizer, xml, xmlwriter, xsl, Zend OPcache, zip, zlib

# PHP Settings
max_execution_time - 120
log_errors_max_len - 1024
max_file_uploads - 20
max_input_nesting_level - 64
max_input_time - 60
max_input_vars - 1000
memory_limit - 256M
post_max_size - 256M
sql.safe_mode - Off
upload_max_filesize - 256M
mysqli.max_links - Unlimited
mysqli.max_persistent - Unlimited
pcre.backtrack_limit - 1000000
pcre.recursion_limit - 100000
pgsql.max_links - Unlimited
pgsql.max_persistent - Unlimited
session.cache_limiter - <i>no value</i>
session.gc_maxlifetime - 7200
opcache.max_accelerated_files - 10000
opcache.max_file_size - 0
opcache.max_wasted_percentage - 5

Browser User-Agent String

Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:63.0) Gecko/20100101 Firefox/63.0

Hide Post Content

This will replace the post content with the message: "Content has been removed by an Administrator"

Hide Content

Request Refund

You may not request a refund that is not currently owned by you.