• Here is the page I am working on

    https://bivenshouse.com/?page_id=16

    I have setup a jquery that I think works to define divHeight.

    <script src="https://bivenshouse.com/wp-content/themes/glossyblue/js/jquery-1.3.2.min.js" type="text/javascript">
    
    <script type="text/javascript">
                    jQuery.noConflict();
                    jQuery(document).ready(function(){
    
    		//dimension
    		var divHeight = (jQuery('#page').height())+20;
    		jQuery("#sidebar").height(divHeight);
    		//alert(divHeight);
    	});
    
    	// mouseover script for images on products page
    	function flipImage(url,names){
    		if(document.images)document[names].src=url;
    	}
    </script>

    But I don’t know to call that variable in my template.

    Here is my sidebar.php

    <div id="sidebar" style="height: 700px;">
    <ul>
    	<li><h3 class="sidebartitle">&nbsp;</h3></li>
        	<li class="cat-item"><a href="https://bivenshouse.com/?page_id=11" title="Bivens House News">News</a></li>
    	<li class="cat-item"><a href="https://bivenshouse.com/?page_id=13" title="Bivens House Press Releases">Press Releases</a></li>
    </ul>
    </div><!-- /sidebar -->

    Currently the style height is hardcoded but I want to be able to use the divHeight from jQuery but I can’t figure out how to call it from inside WP.

    Any suggetions is greatly appreciated.

    – Steve

Viewing 1 replies (of 1 total)
  • Thread Starter stevepierce

    (@stevepierce)

    I am now starting to think the javascript code is not even executing.

    How can I check to see if it is working and that jQuery is running?

    Then what do I need to put in the php template to call the javascript divHeight variable?

    – Steve

Viewing 1 replies (of 1 total)
  • The topic ‘How to call a jquery var in a WP template’ is closed to new replies.