Jump to content

ll87

Member
  • Posts

    36
  • Joined

  • Last visited

Everything posted by ll87

  1. duhhhh. thanks very much, got it sorted now. but in the interests of clean code, i just added "_cont" to end of the id of the main content divs. can i ask about your solution? the $(this).attr('href') would return '#' right now yes? so are u saying it should give the href the value of the div we want to fade in. that way im only using the ID on the div and not on the navigation? thanks again
  2. sorry, there was a full stop after the url
  3. It's working in Chrome, Firefox, and Safari and IE8. http://mymediaventure.com/pricing.php clicking the options on the left fades out the content but the next div does not fade in. Can anyone help? Alex
  4. the only thing against setting them to display:none is that people with javascript turned off (i dont know anyone who does this) won't see them at all.
  5. I have implemented an image fader using jQuery but on first load, you briefly see the 4 images load on top of each other. i have tried to hide the images with regular javascript rather than wait until document ready but i can't track down how to solve this. can i actually get rid of this? if u need the url to see, i completely understand and i can send it to u but not on a forum post. i know i might have been vague but i think it's almost certainly a common problem Thanks!
  6. yea i initially had < but that wasnt working so i changed it. strangely enough i altered it a lot to play around, and then got rid of it all, and now its working with what i posted about. hours wasted for nothing. it's really strange. my friend told me about mysql_insert_id() and its definitely the better way to go
  7. I have the following query code. I insert a record and then do a select to retrieve it. The select is working as I can see it in my DB. Mysql_num_rows gives me a result of 1 which is correct. When i try to retrieve the data using mysql_fetch_array within a for loop, it says the values of id and title are empty which doesn't make sense. I thought it was to do with my query but seeing as the result of num_rows is correct it can't be. I'm stumped :s. $insert = mysql_query('INSERT INTO blog (title,entry) VALUES ("'.$blog_title.'","'.$blog_entry.'")') or die("Error:".mysql_error()); $new_result = mysql_query('SELECT id,title,entry FROM blog WHERE title="'.$blog_title.'" AND entry="'.$blog_entry.'"') or die("Error1:".mysql_error()); echo $new_rows = mysql_num_rows($new_result) or die(mysql_error()); for($i=0;$i<=$new_rows;$i++){ $row = mysql_fetch_array($new_result) or die(mysql_error()); $id = $row['id']; $title = $row['title']; $title = str_replace(" ","_",$title); header('Location: blog.php?title='.$title.'&id='.$id); }
  8. I am using array_slice in PHP to hold 12 elements, as there are 12 images per page on my site. However, now that I have moved over to this method, I can no longer see whether or not there are any images remaining and therefore whether there should be a Next hyperlink. Before i was using readdir and the pointer was always on the next image so it was easy, but now that i am putting all images into one array in one go, i can no longer do it this way. any help? if($skip != 0){ $has_previous = true; } while(($file = readdir($handle)) != false){ //read in all files. $extension = strtolower(substr(strrchr($file, '.'), 1)); //Read string after the . and get substring from the . if($file != '.' || $file != '..'){ if($extension == 'jpg' || $extension == 'jpeg' || $extension == 'JPG'){ $all_images[] = $file; //add file to array. } } } sort($all_images); //sort array alphabetically. $photos = array_slice($all_images,$skip,$per_page); //contains 12 images for each page, in order. //code here to process images. basically i only need the last array slice and then i can get the last element and say if there are any images left, if not dont add a Next link. sample gallery at www.alexbarron.co.uk/galleries.php?trip=Leaving_do
  9. thank you BeeDev, works in Chrome for OS X too. also, i notice when the div slides down, they shift to the left slightly, and when they are hidden they go back to the right.
  10. hey guys, i am working on a site for my friend, and the slideUp/down and fade ins and outs arent working properly, they are a bit jumpy. when a section slides down, it keeps sliding then when finished the bottom jumps up to where it should be. it's the same when i try fading. is it somethng to do with their containers? i haven't got fixed heights so i didn't think so. www.matthewmortimer.co.uk/photography.html is the address. jquery: $(document).ready(function(){ var h3; $("div.image_set").css("display","none"); if($("h3.trigger").length > 0){ $("h3.trigger").click(function(){ if($(this).hasClass("open")){ $(this).removeClass("open"); $(this).next().stop().slideDown(4000); $(".close").next().fadeOut(1000); $(this).addClass("close"); } else{ $(this).removeClass("close"); $(this).addClass("open"); $(this).next().stop().fadeOut(1000); } }) $("h3.trigger").hover(function(){ $(this).css("cursor","pointer"); h3 = $(this).html(); $(this).html(h3+" (click to view/hide images)"); }, function(){ $(this).html(h3); }); } }); thanks in advance
  11. yea this is! today ive been trying to work out how to modify an existing pagination script for my image gallery. take a look at that if u need to quench your problem solving thirst
  12. I am using the script here: http://www.lateralcode.com/simple-php-gallery-pagination/ and trying to modify it so it works with my current image gallery (done differently to theirs) but after loading the first 12 images (first page), clicking on Next goes to page_no 1 but thats as far as it goes, and on page 1 (0 is the first) no pictures load. It's driving me nuts as i dont know which bit of code is messed up. can someone take a look? PHP (gallery_images.php): <?php $country = $_GET['trip']; $directory = 'Images/'.$country; //folder of gallery photos. $thumbs_dir = 'thumbs'; $_thumbs = "_thumb."; //to add to end of each thumbnail's name. $allowed_types = array('jpg','jpeg','gif','png'); $file_parts = array(); //consists of file name and extension. $title = ''; //First part of file parts. $ext = ''; //Second part of file parts. $i = 0; //Iterator to check for last (fourth) image in each row. $per_page = 12; $has_previous = false; $has_next = false; $page_no = $_GET['page_no']; //try to open directory. $dir_handle = opendir($directory) or die("Cannot open directory."); $count = 0; $skip = $page_no * $per_page; if($skip != 0){ $has_previous = true; } while($count < $skip && $file = readdir($dir_handle)) { if(!is_dir($file) && in_array($ext,$allowed_types)) { $count++; } } echo 'page number = '.$page_no; $count = 0; //while($count < $per_page && $file = readdir($dir_handle)) //{ // if(!is_dir($file) && in_array($ext,$allowed_types)){ // $count++; // } //} while($count <= $per_page && $file = readdir($dir_handle)) //Look through folder. { if($file == '.' || $file == '..') continue; //Ignore these files. $file_parts = explode('.',$file); //Split file into its parts and put into array. $ext = strtolower(array_pop($file_parts)); //Puts last item of array into ext. if(in_array($ext,$allowed_types)){ $title = implode('.',$file_parts); //ext has been popped off, so all that remains is title of file. $title = htmlspecialchars($title); //Make title html safe if it isn't already. //Create image to create thumbnail from. $img = imagecreatefromjpeg($directory.'/'.$file); $width = imagesx($img); $height = imagesy($img); //Create thumbnails. $new_width = 150; $new_height = floor($height * ($new_width / $width)); //Creates proportionally correct new height according to new width. floor rounds down to integer. //Create new image with new dimensions to hold thumb $tmp_img = imagecreatetruecolor($new_width,$new_height); //Copy and resize original image into new image. imagecopyresampled($tmp_img,$img,0,0,0,0,$new_width,$new_height,$width,$height); //Store image in a directory if(!is_dir($directory.'/'.$thumbs_dir)) { mkdir($directory.'/'.$thumbs_dir); } imagejpeg($tmp_img,$directory.'/'.$thumbs_dir.'/'.$title.$_thumbs.$ext); //echo '';//'; $nomargin = ''; //Variable for last image of each row. if(in_array($ext,$allowed_types)) //If file is an allowed file type. { //echo ' //'.$title.''; if(($i+1)%4==0) $nomargin = 'nomargin'; //i begins at 0 so add one to correspond to first image. If it is divisable by 4, it //the last of the row, so give special class of nomargin. echo ' '.$title.''; //echo ''; $i++; //Next iteration we are looking at next image. } } $count++; } while($file = readdir($dir_handle)) { if(!is_dir($file) && in_array($ext,$allowed_types)) { $has_next = true; break; } } closedir($dir_handle); //close the directory. ?> PHP (gallery_content.php): <?php include 'gallery_images.php'; ?> <?php if($has_previous){ echo 'Previous'; } if($has_next){ echo 'Next'; } ?>
  13. thanks so much beedev for your help. i understand what you are saying about the widths of the elements, and have edited them as to your recommendations, but it is still giving me problems. the same thing is happening in Mozilla 3.5 for Mac, Safari 3 and Chrome for Mac. not yet tested in IE. i assume you have tested my code? is it fixed your end by just updating the widths to the and tags.
  14. Home Travels California '06 Thailand Malaysia Singapore Australia New Zealand California 2010 Vancouver New York City About Me Portfolio Contact Me Site under construction 2009 © Alex Barron - All Rights Reserved
  15. I am working on a drop down sub menu from a horizontal main navigation. when i hover over a link i want the sub menu to slide down, which it is, however i'm having 2 problems: 1. For a second or two at first the animation does not work and the list simply appears and disappears in accordance with the CSS, instead of sliding instantly. Is this because it uses the CSS rules until the DOM is ready? 2. When the menu slides down, it's width is too narrow until it slides all the way down at which point it widens fullly. I have set the ul and list items to 125px wide, so i don't know why the jquery is keeping it narrow? HTML: Home Travels California '06 Thailand Malaysia Singapore Australia New Zealand California 2010 Vancouver New York City About Me Portfolio Contact Me CSS: /* sub menu */ #wrapper #top #nav li ul#drop_travels { display : none; width : 125px; margin : 0; padding : 0; list-style-position : inside; list-style-type : none; position : absolute; top : auto; left : 0; } #wrapper #top #nav li:hover ul#drop_travels { display : block; } #wrapper #top #nav li #drop_travels li { margin : 0; width : 125px; } #wrapper #top #nav li #drop_travels li a { display : block; width : 125px; height : 28px; background : url("../Images/nav_drop_li_bg.png") top left no-repeat; padding-left : 5px; padding-top : 4px; /*Move text down*/ margin-bottom : -4px; /*Correct so no gap between items shows*/ } #wrapper #top #nav li #drop_travels li a.top { background : url("../Images/nav_drop_li_top_bg.png") top left no-repeat; } #wrapper #top #nav li #drop_travels li a.bottom { background : url("../Images/nav_drop_li_bottom_bg.png") top left no-repeat; } jQuery: $(document).ready(function(){ $('#wrapper #top #nav li ul#drop_travels').width('125px'); $('#wrapper #top #nav li a.drop').hover( function(){ $('#wrapper #top #nav li ul#drop_travels').slideDown(); }, function(){ $('#wrapper #top #nav li ul#drop_travels').slideUp(); } ); }); Any idea?
  16. ll87

    PHP pagination

    how does it display the next set of images? a block echo-ing some html img tags does not directly follow this snippet, so i dont understand how it displays the next set. i understand what your saying it SHOULD be doing, but it still doesn't make sense looking at what code is actually there. seems like there is something missing
  17. ll87

    PHP pagination

    but i dont see how, because it's not doing anything with the updated $count variable? where does it use that to ensure the next batch of images are loaded? thanks for your help
  18. ll87

    PHP pagination

    I found this guide on how to create a paginated image gallery in PHP. I have adapted it to suit my needs, but there is one bit which is completely stumping me. I reckon you'd have to read it all to be able to help me, so please do, if you have the time: http://www.lateralcode.com/simple-php-gallery-pagination/ The bit which is confusing me is: $count = 0; $skip = $page * $per_page; while ( $count < $skip && ($file = readdir($handle)) !== false ) { if ( !is_dir($file) && ($type = getPictureType($file)) != '' ) $count++; } the reason is, on the next line, it resets $count to 0, so the above loop to me seems pointless. I took it out and re-ran the code and it breaks so it is needed. But all it does is increment count until count equals skip and then it is reset on the next line anyways. i think the main reason im getting so confused is that the article isn't explaining it wel enough, perhaps because they don't expect the reader to be a noob, ha. help me someone please .
  19. see i told u it was a dumb question. thanks a lot mate
  20. On horizontal lists, such as for navigation menus, how are sites such as HSBC.co.uk and http://www.commbank.com.au/corporate/ getting those dividers (vertical white lines) between each item. they are clearly images but ive gone through them with firebug and can't find them. it's something id really like to apply but it seems like a dumb question to ask. im asking it anyway as it's doing my head in!
  21. ll87

    goodtoknow website

    thanks for your help. i still can't find that rule, it's because i'm not using firebug properly, point me in the right direction?
  22. ll87

    goodtoknow website

    the website at www.goodtoknow.co.uk has a nice tabbed menu (imo) but when right clicking one to find their background images, nothing comes up in the list to do it. surely they use images? i used firebug to look at the css briefly but nothing that puts an image there. is there a way they would have blocked viewers from getting the background image?
×
×
  • Create New...