SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Member
    Join Date
    Dec 2011
    Posts
    2
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    problem in Integrating Slider in wordpress theme

    hello,

    in my wordpress theme I put jquery slider which contain customer feedback

    first when i design the theme in html/css the slider works perfectly .

    but when Iconvert html/css to wordpress theme the slider stop working!

    this is the code that relate to the slider :

    in header.php:
    Code:
    <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
    	<script type="text/javascript">
    $(document).ready(function(){
      var currentPosition = 0;
      var slideWidth = 234;
      var slides = $('.slide');
      var numberOfSlides = slides.length;
    
      // Remove scrollbar in JS
      $('#slidesContainer').css('overflow', 'hidden');
    
      // Wrap all .slides with #slideInner div
      slides
      .wrapAll('<div id="slideInner"></div>')
      // Float left to display horizontally, readjust .slides width
      .css({
        'float' : 'left',
        'width' : slideWidth
      });
    
      // Set #slideInner width equal to total width of all slides
      $('#slideInner').css('width', slideWidth * numberOfSlides);
    
      // Insert left and right arrow controls in the DOM
      $('#slideshow')
        .prepend('<span class="control" id="leftControl">Move left</span>')
        .append('<span class="control" id="rightControl">Move right</span>');
    
      // Hide left arrow control on first load
      manageControls(currentPosition);
    
      // Create event listeners for .controls clicks
      $('.control')
        .bind('click', function(){
        // Determine new position
          currentPosition = ($(this).attr('id')=='rightControl')
        ? currentPosition+1 : currentPosition-1;
    
          // Hide / show controls
          manageControls(currentPosition);
          // Move slideInner using margin-left
          $('#slideInner').animate({
            'marginLeft' : slideWidth*(-currentPosition)
          });
        });
    
      // manageControls: Hides and shows controls depending on currentPosition
      function manageControls(position){
        // Hide left arrow if position is first slide
        if(position==0){ $('#leftControl').hide() }
        else{ $('#leftControl').show() }
        // Hide right arrow if position is last slide
        if(position==numberOfSlides-1){ $('#rightControl').hide() }
        else{ $('#rightControl').show() }
        }
      });
    
    </script>
    in about.php :
    Code:
    <div id="slideshow">
      <div id="slidesContainer">
     <?php $args = array(
    	'category_name' => 'feedback',
    	'orderby' => 'date',
    	'order'    => 'ASC'
    );
    query_posts( $args );?>
    
    <?php while (have_posts()) : the_post(); ?> 
    
        <div class="slide">
         <div><?php the_content(); ?></div>
    	 <div ><?php the_title(); ?></div>
        </div>
    
    	 <?php endwhile; ?> 
    
      </div>
    </div>
    in style.css:
    Code:
    #slideshow {
    	margin:0 auto;
    	width:254px;
    	height:180px;
    	position:relative;
    
    }
    
    #slideshow #slidesContainer {
      margin:0 auto;
      width:234px;
      height:180px;
      overflow:auto; /* allow scrollbar */
      position:relative;
    
    }
    
    #slideshow #slidesContainer .slide {
      margin:0 auto;
      width:214px; /* reduce by 20 pixels to avoid horizontal scroll */
      height:180px;
      color:#663399;
    
    }
    
    .control {
      display:block;
      width:52px;
      height:52px;
      text-indent:-10000px;
      position:absolute;
      cursor: pointer;
    	      margin-top:35%;
        margin-bottom:35%;
    }
    #leftControl {
      top:0;
      left:0;
      margin-left:-40px;
      background:transparent url(images/control_left.png) no-repeat 0 0;
    }
    #rightControl {
      top:0;
      right:0;
        margin-right:-40px;
      background:transparent url(images/control_right.png) no-repeat 0 0;
    }

  2. #2
    It's all Geek to me silver trophybronze trophy
    ralph.m's Avatar
    Join Date
    Mar 2009
    Location
    Melbourne, AU
    Posts
    23,590
    Mentioned
    411 Post(s)
    Tagged
    6 Thread(s)
    Hi lifeshadows. Welcome to SitePoint.

    Is there a chance you could provide a link to the live page?

  3. #3
    SitePoint Member
    Join Date
    Dec 2011
    Posts
    2
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by ralph.m View Post
    Hi lifeshadows. Welcome to SitePoint.

    Is there a chance you could provide a link to the live page?
    no it is in the localhost


Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •