WordPress.org

Support

Support » Themes and Templates » Activate the jquery script on my PHP

Activate the jquery script on my PHP

  • Hi everyone!
    I have an HTML document that I converted into a wordpress theme. I have a jquery script on my “header.php” that works fine as HTML, but not running properly (actually, not at all!)

    On my “header.php” file I have:

    <script type="text/javascript" src="Scripts/jquery-1.2.6.min.js"></script>
    
    <script type="text/javascript">
    
    function slideSwitch() {
        var $active = $('#slideshow IMG.active');
    
        if ( $active.length == 0 ) $active = $('#slideshow IMG:last');
    
        // use this to pull the images in the order they appear in the markup
        var $next =  $active.next().length ? $active.next()
            : $('#slideshow IMG:first');
    
        // uncomment the 3 lines below to pull the images in random order
    
        // var $sibs  = $active.siblings();
        // var rndNum = Math.floor(Math.random() * $sibs.length );
        // var $next  = $( $sibs[ rndNum ] );
    
        $active.addClass('last-active');
    
        $next.css({opacity: 0.0})
            .addClass('active')
            .animate({opacity: 1.0}, 200, function() {
                $active.removeClass('active last-active');
            });
    }
    
    $(function() {
        setInterval( "slideSwitch()", 7000 );
    });
    
    </script>

    And on my “index.php” I call upon these images:

    <div id="slideshow">
      	<img src="<?php bloginfo('template_directory'); ?>/images/CDjewelCase.jpg" alt="" class="active"/>
      	<img src="<?php bloginfo('template_directory'); ?>/images/scroller.jpg" alt=""  />
      </div><!--end slideshow-->

    On my CSS I have:

    #slideshow{
    	position:relative;
    	width:960px;
    	height:308px;
    	margin-left:auto;
    	margin-right:auto;
    	top:45px;
    }
    
    #slideshow IMG{
    	position:absolute;
    	top:0;
    	left:0;
    	z-index:8;
    	opacity:0.0;
    }
    
    #slideshow IMG.active {
    	z-index:10;
    	opacity:1.0;
    }
    
    #slideshow IMG.last-active {
    	z-index:9;
    }

    Like I said, these works fine on HTML, but not on PHP. Can anyone help me make it work on my theme?

    Thank you in advance!
    Rafa.

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Activate the jquery script on my PHP’ is closed to new replies.
Skip to toolbar