Tagged: ,

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #584673

    i am trying to add a class into the html element, but somehow it doesnt work?
    i need to see via css if java is enabled or not

    option1:
    (function($) {
    “use strict”;
    $(document).ready(function() {
    $(‘div’).addClass(‘js’);
    });
    })(jQuery);

    option 2:
    var $j = jQuery.noConflict();

    $j(function(){
    $j(document).ready(function() {
    $j(‘html’).addClass(‘yes_jquery’);
    });
    });

    #584681

    Hi eaonflux!

    Could this be what you are looking for – http://kriesi.at/documentation/enfold/turn-on-custom-css-field-for-all-alb-elements/?

    Cheers!
    Yigit

    #584806

    ah thanks for your reply.
    No this is not what i want.

    The thing is i want to do a jquery check .

    example:

    visitors has jquery/javascript enabled in browser above wouyld just add a class into the html element

    <html class=”yes_jquery”>

    so i can do this:

    html article p.class {
    do some styleing when jquery is not supported
    }
    html .yes_jquery article p.class {
    do some styleing when jquery is supported
    }

    #585993

    Hey!

    You can use a plugin like https://wordpress.org/plugins/browser-check/screenshots/

    Or if you like to do it the jQuery way use the below code. You cannot use the if/else to detect javascript on client browser because if js is disabled your code will not run. and noscript will run when js is not detected by the browser.

         <script type="text/javascript">
          document.write("Hi, JavaScript is enabled!");
        </script>
        <noscript>
            <p>JavaScript is not enabled!</p> 
        </noscript>
    

    Regards,
    Vinay Kashyap

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.