Break slider function and spit out just the HTML inside slides

tech's Avatar

tech

09 Feb, 2018 10:41 PM

Hello guys (and girls),

I have been wondering: when I populate the slides with HTML is there any easy way to remove the slider function (by use of CSS or jQuery) so that just the HTML remains?

Example: my slides have much content that makes it unusable on smaller devices and I would like to just use the content in the slides stocked top-bottom as it would be for regular content, no slider function.

In short: remove the function that places the HTML in the slides horizontally and slidable and keep the content.

Something like: if is wp_mobile { remove slider function } + some CSS, I dont know
 
Usually I create completely new content for this but it seems to me it could be easier.

Thanks in advance for any help!

Nick

  1. Support Staff 1 Posted by Dmitry Semenov on 10 Feb, 2018 12:04 PM

    Dmitry Semenov's Avatar

    Hello,

    Implementing this dynamically during page resize would take some work - as slider heavily modifies markup after initialization. You'll need to store starting markup in some variable and swap slider with it when needed.

    Otherwise, if you want to just disable it on page load, you can do something as simple as removing the class on the root element of slider, so JS code won't be fired at all, e.g.:

    // add to theme functions.php
    
    function disable_slider_js() {
        ?>
        var something = true;
        if (something) {
            $('.royalSlider').removeClass();
        }
        
        <?php
    }
    add_action('new_rs_before_js_init_code', 'disable_slider_js');
    
  2. 2 Posted by tech on 10 Feb, 2018 03:38 PM

    tech's Avatar

    Thank you Dimitry, appreciate that!

Reply to this discussion

Internal reply

Formatting help / Preview (switch to plain text) No formatting (switch to Markdown)

Attaching KB article:

»

Attached Files

You can attach files up to 10MB

If you don't have an account yet, we need to confirm you're human and not a machine trying to post spam.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac