• I am trying to apply a simple toggle effect of jquery in page like
    this
    http://eightfoldinfotech.com/test/

    But i am not able to achieve this in my wordpress page.

    http://eightfoldinfotech.com/dumra3/?page_id=21

    Here what i did

    Header.php

    <script language="javascript" type="text/javascript" src="<?php echo get_template_directory_uri(); ?>/js/modernizr.custom.js"></script>
    <script  type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>

    In page

    <script type="text/javascript">// <![CDATA[
    jQuery(document).ready(function(){
      $('#one').click(function(){
    
        $("#explain").slideToggle(500);
      });
    });
    // ]]></script>
    
    <button class="exams_button" id="one">ENGINEERING ENTRANCE EXAM </button>
    <div class="details" id="explain"></div>

    And here is my css

    .regular
    {	float:left;
    	width:92%;
    	height:auto;
    	padding:2% 2%;
    	background:#e8e9ea;
    	margin:2% 2% 2% 4%;
    	display:none;
    }

Viewing 2 replies - 1 through 2 (of 2 total)
  • Your page got js error, not sure it is the reason why it can’t work.

    BTW, you should enqueue scripts using wp_enqueue_script rather than putting them directly in the template.

    And it’s better to use the jquery that wordpress registered for you.

    Andrew Nevins

    (@anevins)

    WCLDN 2018 Contributor | Volunteer support

    Somehow you’ve got some HTML in your JavaScript:

    jQuery(document).ready(function(){
      $('#one').click(function(){</p>
    <p>    $("#explain").slideToggle(500);
      });
    });

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Jquery problem’ is closed to new replies.