Jump to content

ab2qik

New Members
  • Posts

    6
  • Joined

  • Last visited

Profile Information

  • Gender
    Not Telling

ab2qik's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Ooh heres the php part: <?php $items = array( 'image1' => '8252313238', 'image2' => '8247338432', 'image3' => '8251341199', 'image4' => '8248530301', 'image5' => '8253003584', 'image6' => '8241570649' ); $imageId = $_REQUEST['imageId']; $item = $items[$imageId]; ?> <div align="center"> <?php if ($imageId != "") { ?> <img id="itemPhoto" src="images/<?php echo $item; ?>.jpg" /> <?php } ?> </div>
  2. Hello Xaotique, thanks for quick reply. Hope the code displays as you wanted it to. Heres a link to it: http://www.codesolv..../carousel-ajax/ $(document).ready(function() { var spacing = 140; //console.log(imagename); $('#imageSlide') .css( { 'width': spacing * 3, 'height': '166px', 'overflow': 'hidden' } ) .find('.covers a') .css( { 'float': 'none', 'position': 'absolute', 'left': 1000 } ); var setUpCovers = function() { var $covers = $('#imageSlide .covers a'); var prev = $('.controler a.prev'); prev.unbind('click'); var next = $('.controler a.next'); next.unbind('click'); // Left image; scroll right (to view images on left). $covers.eq(0) .css('left', 0); prev .click(function(event) { $covers.eq(2) .css('left', 1000); $covers.eq($covers.length - 1) .prependTo('#imageSlide .covers'); setUpCovers(); }); // Right image; scroll left (to view images on right). $covers.eq(2) .css('left', spacing * 2); next .click(function(event) { $covers.eq(0) .css('left', 1000); $covers.eq(0) .appendTo('#imageSlide .covers'); setUpCovers(); }); // Center image. $covers.eq(1) .css('left', spacing); }; setUpCovers(); var imageLoader = function() { $('form').submit(function() { $('#imageSlide') .load('scripts/imageHolder.php', $(this).serialize()); }); $('form-container').submit(function(event) { //$(event.target).remove(); }); } imageLoader(); });
  3. Hello All! code below is for a carousel of a few images. Images are inline on page body. It has next / previous navigation. It also has a search box to enable search of an image by its name. Its an ajax request to a php file that uses an array to hold the images. Navigation by next / prev works. Using ajax search displays the specific image searched for on a first search. The searched image gets loaded into the carousel and hides the viewable images in the carousel viewable area. This is desired. But a second search does not seem to generate an ajax request when checking in firebug console panel. The searched image is replaced by the viewable images instead. How can it be edited to make each ajax search show up and update the viewale area. Thankyou for any help. JS: $(document).ready(function() { var spacing = 140; //console.log(imagename); $('#imageSlide') .css( { 'width': spacing * 3, 'height': '166px', 'overflow': 'hidden' } ) .find('.covers a') .css( { 'float': 'none', 'position': 'absolute', 'left': 1000 } ); var setUpCovers = function() { var $covers = $('#imageSlide .covers a'); var prev = $('.controler a.prev'); prev.unbind('click'); var next = $('.controler a.next'); next.unbind('click'); // Left image; scroll right (to view images on left). $covers.eq(0) .css('left', 0); prev .click(function(event) { $covers.eq(2) .css('left', 1000); $covers.eq($covers.length - 1) .prependTo('#imageSlide .covers'); setUpCovers(); }); // Right image; scroll left (to view images on right). $covers.eq(2) .css('left', spacing * 2); next .click(function(event) { $covers.eq(0) .css('left', 1000); $covers.eq(0) .appendTo('#imageSlide .covers'); setUpCovers(); }); // Center image. $covers.eq(1) .css('left', spacing); }; setUpCovers(); var imageLoader = function() { $('form').submit(function() { $('#imageSlide') .load('scripts/imageHolder.php', $(this).serialize()); }); $('form-container').submit(function(event) { //$(event.target).remove(); }); } imageLoader(); }); PHP: <?php $items = array( 'image1' => '8252313238', 'image2' => '8247338432', 'image3' => '8251341199', 'image4' => '8248530301', 'image5' => '8253003584', 'image6' => '8241570649' ); $imageId = $_REQUEST['imageId']; $item = $items[$imageId]; ?> <div align="center"> <?php if ($imageId != "") { ?> <img id="itemPhoto" src="images/<?php echo $item; ?>.jpg" /> <?php } ?> </div>
  4. Thankyou for the tips mjdamato. I am testing out loops(and other code) before using in real enviroment. Sure enough foreach was simpler to use compared with the solution posted. It was tested after foreach. Your other points i would definietly bear in mind for real case use. I think next time i post test code i will make this effort.
  5. Absolutely right. It should be </li>. A silly typo that wasted your time. Thankyou.
  6. Hello, Got problems displaying a list within a loop. It dislays an empty li between filled li's as seen in frebug. Any way to avoid this? Thankyou. <style type="text/css"> ul {margin: 0; padding: 0;} li {margin: 0.5em; padding: 0; list-style: none;} </style> $prices = array('Tyres' => 125.00, 'Oil' => 5.50, 'Sparkplugs' => 0.50); echo '<ul>'; while (list ($key, $value) = each($prices)) { echo '<li>'.$key. ' - ' .$value.'<li>'; } echo '</ul>';
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.