JavaScript - Gallery Isnt Working
For some reason the gallery image isnt poping up in a window, it just opens it in a separate page. Anyway able to assist?
www.habugfx.com/HabuMAC/portfolio.html Similar Tutorialssorted.
I have this which runs on keyup in a textbox but i dont want it to run if the pressed key is enter, how would i go about that? Code: function getList() { var xmlhttp; if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safari xmlhttp=new XMLHttpRequest(); } else {// code for IE6, IE5 xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); } xmlhttp.onreadystatechange=function() { if (xmlhttp.readyState==4 && xmlhttp.status==200) { showDiv('#', 'result'); document.getElementById("result").innerHTML=xmlhttp.responseText; } } var user = document.getElementById('friendsSearch').value; xmlhttp.open("GET","../friendSearch.php?username="+user,true); xmlhttp.send(); } Problem/Error: JavaScript/AJAX not returning values correctly... The JavaScript/AJAX is printing "null" into the chat_div where the tag name is "user". But in those tags there is actually data, this data is a link. I am thinking that it may be returning the first childNode which would be the <a>? I don't fully understand nodes, but I have had a quick read about them. PHP: PHP Code: <?php //Headers header("Expires: Mon, 01 Dec 1990 05:00:00 GMT" ); header("Last-Modified: " . gmdate( "D, d M Y H:i:s" ) . "GMT" ); header("Cache-Control: no-cache, must-revalidate" ); header("Pragma: no-cache" ); header("Content-Type: text/xml; charset=utf-8"); require("connect.php"); mysql_select_db($dbname, $con); //Variables $ses = explode(".", $_SESSION['user']); //User ID of user currently logged in $sid = $ses[2]; //Number of last message which was displayed, if does not exist or has no value then //last message will be 0. $last_mess = (isset($_GET['m']) && $_GET['m'] != "") ? $_GET['m'] : 0; $last_mess = mysql_real_escape_string($last_mess); $chat = mysql_real_escape_string($_GET['chat']); //Counter for counter number of errors $i = 1; //Send message if (isset($_POST['message']) && $_POST['message'] != "") { //Variables $chat = mysql_real_escape_string($_GET['chat']); $message = mysql_real_escape_string($_GET['message']); $query = "INSERT INTO message (chat_id, user_uid, recipient_uid, message, post_time) VALUES (". $chat.", ".$sid.", ".$rid.", ".$message.", NOW())"; mysql_query($query); } //Get current chat if (isset($_GET['chat'])) { $xml = '<?xml version="1.0" ?><root>'; $query = "SELECT * FROM message WHERE chat_id = ".$chat." AND msg_id > ".$last_mess; $result = mysql_query($query); while ($row=mysql_fetch_array($result)) { //Get name of sender $get_name_query = "SELECT * FROM users WHERE uid = '".$row['user_uid']."' OR uid = '".$row['recipient_uid']."'"; $get_name = mysql_query($get_name_query); if (!$get_name) { //If there is no result display error echo "Error $i: Error getting usernames! <br /> Query: $get_name_query <br />MySQL Error: ".mysql_error(). "<br /><br />"; $i++; } //While result is being got get first name and upper case first letter. while ($row2=mysql_fetch_array($get_name)) { $name = explode(".",$row2['full_name']); $first_name = $name[0]; $userid = $row2['uid']; $sent_by = "<a href=\"../profile.php?user=".$userid."\">".ucfirst($first_name)."</a>"; } //Write message contents $xml .= '<message id="' . $row['msg_id'] . '">'; $xml .= '<user>' . $sent_by . '</user>'; $xml .= '<text>' . $row['message'] . '</text>'; $xml .= '<time>' . $row['post_time'] . '</time>'; $xml .= '</message>'; } $xml .= '</root>'; echo $xml; } ?> JavaScript/AJAX: Code: function getMessage() { if (receiveReq.readyState == 4 || receiveReq.readyState == 0) { var url = "scripts/get_data.php?uid=<?=$uid?>&m=" + lastMess + "&chat=1"; receiveReq.open("GET", url, true); receiveReq.onreadystatechange = manageMessage; receiveReq.send( null ); lastMess++; } } function manageMessage() { if( receiveReq.readyState == 4 ) { // request complete var chat_div = document.getElementById( 'chat' ); var xmldoc = receiveReq.responseXML; var msg_nodes = xmldoc.getElementsByTagName( 'message' ); var n_msg = msg_nodes.length; for( i = 0; i < n_msg; i++ ) { var user_node = msg_nodes[ i ].getElementsByTagName( 'user' ); var time_node = msg_nodes[ i ].getElementsByTagName( 'time' ); var text_node = msg_nodes[ i ].getElementsByTagName( 'text' ); //Display message chat_div.innerHTML += user_node[ 0 ].firstChild.nodeValue + "<br />"; chat_div.innerHTML += time_node[ 0 ].firstChild.nodeValue + "<br />"; chat_div.innerHTML += text_node[ 0 ].firstChild.nodeValue + "<br /><br />"; } } } More info: The PHP is displaying the data properly, like so: XML: Code: <root> <message id="1"> <user> <a href="../profile.php?user=4">Nicholas</a> </user> <text>testing stupid chat thing</text> <time>0000-00-00 00:00:00</time> </message> <message id="2"> <user> <a href="../profile.php?user=4">Nicholas</a> </user> <text>dsadasfsdfsggsdgrgsdgfd</text> <time>2010-04-22 19:17:16</time> </message> <message id="3"> <user> <a href="../profile.php?user=4">Nicholas</a> </user> <text>gfgdgsegegsgfawdfwdfasfa</text> <time>2010-04-14 17:28:07</time> </message> </root> What is being displayed on the page: Code: null 0000-00-00 00:00:00 testing stupid chat thing null 2010-04-22 19:17:16 dsadasfsdfsggsdgrgsdgfd null 2010-04-14 17:28:07 gfgdgsegegsgfawdfwdfasfa Im having some problem with stopping a function i run on loop using setInterval Code: $(document).ready(function(){ var Cycle = setInterval('cycle()', 3000); /* ... some other functions here ... */ $('.Test').click(function(){ var ID = $(this).attr('ID'); clearInterval(Cycle); /* ... Rest of this function ... */ if (ID == 'Home') { var Cycle = setInterval('cycle()', 3000); } console.log(ID); }); }); When i click a link with the Test class it runs through the function but the loop never stops and im not sure why, cant anyone help me solve this? If you want to see the bits of JS i cut out just say but i dont think there relevant. EDIT: Seems to be the if (ID == 'Home') bit which is causing the problems even though when in the log it shows ID being the word 'Live'. Have i missed some stupid obvious thing ? Whenever i click I am new to this kind of scripting, so I have not done it before, I have tried to find solutions on the net but none have worked. I have a 'contact us' form, which includes 2 radio buttons to select how they wish to recieve their reply... the first radio is 'email' the second radio is 'phone' When the 'phone' radio is selected, i want the div including a drop downbox to appear to ask what time to recieve a call, but when the 'email' radio is selected, this div does not appear. This is the script for this section. . .. ... <span>Best way to reply:</span> <input type="radio" name="reply" value="Email" id="reply_0" /> E-mail <BR /> <div style="margin-left:270px;"><input type="radio" name="reply" value="Phone" id="reply_1" onclick=""/>Phone</div> <br/> <div id="timehide"><span>Best time to get hold of you:</span> <select> <option value="Any">Any</option> <option value="06:00 - 10:00">06:00 - 10:00</option> <option value="10:00 - 12:00">10:00 - 12:00</option> <option value="12:00 - 14:00">12:00 - 14:00</option> <option value="14:00 - 16:00">14:00 - 16:00</option> <option value="16:00 - 18:00">16:00 - 18:00</option> <option value="18:00 - 20:00">18:00 - 20:00</option> </select></div> ... .. . if anyone could help me it would be greatly appreciated!!! Cheers, Ben! I am new to this kind of scripting, so I have not done it before, I have tried to find solutions on the net but none have worked. I have a 'contact us' form, which includes 2 radio buttons to select how they wish to recieve their reply... the first radio is 'email' the second radio is 'phone' When the 'phone' radio is selected, i want the div including a drop downbox to appear to ask what time to recieve a call, but when the 'email' radio is selected, this div does not appear. This is the script for this section. . .. ... <span>Best way to reply:</span> <input type="radio" name="reply" value="Email" id="reply_0" /> E-mail <BR /> <div style="margin-left:270px;"><input type="radio" name="reply" value="Phone" id="reply_1" onclick=""/>Phone</div> <br/> <div id="timehide"><span>Best time to get hold of you:</span> <select> <option value="Any">Any</option> <option value="06:00 - 10:00">06:00 - 10:00</option> <option value="10:00 - 12:00">10:00 - 12:00</option> <option value="12:00 - 14:00">12:00 - 14:00</option> <option value="14:00 - 16:00">14:00 - 16:00</option> <option value="16:00 - 18:00">16:00 - 18:00</option> <option value="18:00 - 20:00">18:00 - 20:00</option> </select></div> ... .. . if anyone could help me it would be greatly appreciated!!! Cheers, Ben! Dear Friends, I have a javascript image gallery in my website.. it is working Good.. But now i have some problem... i have to get the Loaded image url. i need users to post comments about that image. So i have to get the URL or name of image. This is needed in a text input field... So please see the code of gallery and help me.. The code is below.. Or Check it here http://www.home-palettes.com/gallery.html Code: //add thickbox to href elements that have a class of .thickbox function TB_init(){ $("a.thickbox").click(function(){ var t = this.title || this.name || null; var g = this.rel || false; TB_show(t,this.href,g); this.blur(); return false; }); $("a.thickbox").css({display:"inline"}); } function TB_show(caption, url, imageGroup) {//function called when the user clicks on a thickbox link var images_location = 'extensions/thickbox_2' try { if (document.getElementById("TB_HideSelect") == null) { $("body").append("<iframe id='TB_HideSelect'></iframe><div id='TB_overlay'></div><div id='TB_window'></div>"); $("#TB_overlay").click(TB_remove); } if(caption==null){caption=""}; $(window).scroll(TB_position); TB_overlaySize(); $("body").append("<div id='TB_load'><img src='"+images_location+"/loadingAnimation.gif' /></div>"); TB_load_position(); if(url.indexOf("?")!==-1){ //If there is a query string involved var baseURL = url.substr(0, url.indexOf("?")); }else{ var baseURL = url; } var urlString = /\.jpg|\.jpeg|\.png|\.gif|\.bmp/g; var urlType = baseURL.toLowerCase().match(urlString); if(urlType == '.jpg' || urlType == '.jpeg' || urlType == '.png' || urlType == '.gif' || urlType == '.bmp'){//code to show images TB_PrevCaption = ""; TB_PrevURL = ""; TB_PrevHTML = ""; TB_NextCaption = ""; TB_NextURL = ""; TB_NextHTML = ""; TB_imageCount = ""; TB_FoundURL = false; if(imageGroup){ TB_TempArray = $("a[@rel="+imageGroup+"]").get(); for (TB_Counter = 0; ((TB_Counter < TB_TempArray.length) && (TB_NextHTML == "")); TB_Counter++) { var urlTypeTemp = TB_TempArray[TB_Counter].href.toLowerCase().match(urlString); if (!(TB_TempArray[TB_Counter].href == url)) { if (TB_FoundURL) { TB_NextCaption = TB_TempArray[TB_Counter].title; TB_NextURL = TB_TempArray[TB_Counter].href; TB_NextHTML = "<span id='TB_next'> <a href='#'>Next ></a></span>"; } else { TB_PrevCaption = TB_TempArray[TB_Counter].title; TB_PrevURL = TB_TempArray[TB_Counter].href; TB_PrevHTML = "<span id='TB_prev'> <a href='#'>< Prev</a></span>"; } } else { TB_FoundURL = true; TB_imageCount = "Image " + (TB_Counter + 1) +" of "+ (TB_TempArray.length); } } } imgPreloader = new Image(); imgPreloader.onload = function(){ imgPreloader.onload = null; // Resizing large images - orginal by Christian Montoya edited by me. var pagesize = TB_getPageSize(); var x = pagesize[0] - 150; var y = pagesize[1] - 150; var imageWidth = imgPreloader.width; var imageHeight = imgPreloader.height; if (imageWidth > x) { imageHeight = imageHeight * (x / imageWidth); imageWidth = x; if (imageHeight > y) { imageWidth = imageWidth * (y / imageHeight); imageHeight = y; } } else if (imageHeight > y) { imageWidth = imageWidth * (y / imageHeight); imageHeight = y; if (imageWidth > x) { imageHeight = imageHeight * (x / imageWidth); imageWidth = x; } } // End Resizing TB_WIDTH = imageWidth + 30; TB_HEIGHT = imageHeight + 60; $("#TB_window").append("<a href='' id='TB_ImageOff' title='Close'><img id='TB_Image' src='"+url+"' width='"+imageWidth+"' height='"+imageHeight+"' alt='"+caption+"'/></a>" + "<div id='TB_caption'>"+caption+"<div id='TB_secondLine'>" + TB_imageCount + TB_PrevHTML + TB_NextHTML + "</div></div><div id='TB_closeWindow'><a href='#' id='TB_closeWindowButton' title='Close'>close</a></div>"); $("#TB_closeWindowButton").click(TB_remove); if (!(TB_PrevHTML == "")) { function goPrev(){ if($(document).unclick(goPrev)){$(document).unclick(goPrev)}; $("#TB_window").remove(); $("body").append("<div id='TB_window'></div>"); TB_show(TB_PrevCaption, TB_PrevURL, imageGroup); return false; } $("#TB_prev").click(goPrev); } if (!(TB_NextHTML == "")) { function goNext(){ $("#TB_window").remove(); $("body").append("<div id='TB_window'></div>"); TB_show(TB_NextCaption, TB_NextURL, imageGroup); return false; } $("#TB_next").click(goNext); } /* document.onkeydown = function(e){ if (e == null) { // ie keycode = event.keyCode; } else { // mozilla keycode = e.which; } if(keycode == 27){ // close TB_remove(); } else if(keycode == 190){ // display previous image if(!(TB_NextHTML == "")){ document.onkeydown = ""; goNext(); } } else if(keycode == 188){ // display next image if(!(TB_PrevHTML == "")){ document.onkeydown = ""; goPrev(); } } } */ TB_position(); $("#TB_load").remove(); $("#TB_ImageOff").click(TB_remove); $("#TB_window").css({display:"block"}); //for safari using css instead of show } imgPreloader.src = url; }else{//code to show html pages var queryString = url.replace(/^[^\?]+\??/,''); var params = TB_parseQuery( queryString ); TB_WIDTH = (params['width']*1) + 30; TB_HEIGHT = (params['height']*1) + 40; ajaxContentW = TB_WIDTH - 30; ajaxContentH = TB_HEIGHT - 45; if(url.indexOf('TB_iframe') != -1){ urlNoQuery = url.split('TB_'); $("#TB_window").append("<div id='TB_title'><div id='TB_ajaxWindowTitle'>"+caption+"</div><div id='TB_closeAjaxWindow'><a href='#' id='TB_closeWindowButton' title='Close'>close</a></div></div><iframe frameborder='0' hspace='0' src='"+urlNoQuery[0]+"' id='TB_iframeContent' name='TB_iframeContent' style='width:"+(ajaxContentW + 29)+"px;height:"+(ajaxContentH + 17)+"px;' onload='TB_showIframe()'> </iframe>"); }else{ $("#TB_window").append("<div id='TB_title'><div id='TB_ajaxWindowTitle'>"+caption+"</div><div id='TB_closeAjaxWindow'><a href='#' id='TB_closeWindowButton'>close</a></div></div><div id='TB_ajaxContent' style='width:"+ajaxContentW+"px;height:"+ajaxContentH+"px;'></div>"); } $("#TB_closeWindowButton").click(TB_remove); if(url.indexOf('TB_inline') != -1){ $("#TB_ajaxContent").html($('#' + params['inlineId']).html()); TB_position(); $("#TB_load").remove(); $("#TB_window").css({display:"block"}); }else if(url.indexOf('TB_iframe') != -1){ TB_position(); if(frames['TB_iframeContent'] == undefined){//be nice to safari $("#TB_load").remove(); $("#TB_window").css({display:"block"}); $(document).keyup( function(e){ var key = e.keyCode; if(key == 27){TB_remove()} }); } }else{ $("#TB_ajaxContent").load(url, function(){ TB_position(); $("#TB_load").remove(); $("#TB_window").css({display:"block"}); }); } } $(window).resize(TB_position); document.onkeyup = function(e){ if (e == null) { // ie keycode = event.keyCode; } else { // mozilla keycode = e.which; } if(keycode == 27){ // close TB_remove(); } } } catch(e) { alert( e ); } } //helper functions below function TB_showIframe(){ $("#TB_load").remove(); $("#TB_window").css({display:"block"}); } function TB_remove() { $("#TB_window").fadeOut("fast",function(){$('#TB_window,#TB_overlay,#TB_HideSelect').remove();}); $("#TB_load").remove(); return false; } function TB_position() { var pagesize = TB_getPageSize(); var arrayPageScroll = TB_getPageScrollTop(); $("#TB_window").css({width:TB_WIDTH+"px",left: (arrayPageScroll[0] + (pagesize[0] - TB_WIDTH)/2)+"px", top: (arrayPageScroll[1] + (pagesize[1]-TB_HEIGHT)/2)+"px" }); } function TB_overlaySize(){ if (window.innerHeight && window.scrollMaxY || window.innerWidth && window.scrollMaxX) { yScroll = window.innerHeight + window.scrollMaxY; xScroll = window.innerWidth + window.scrollMaxX; var deff = document.documentElement; var wff = (deff&&deff.clientWidth) || document.body.clientWidth || window.innerWidth || self.innerWidth; var hff = (deff&&deff.clientHeight) || document.body.clientHeight || window.innerHeight || self.innerHeight; xScroll -= (window.innerWidth - wff); yScroll -= (window.innerHeight - hff); } else if (document.body.scrollHeight > document.body.offsetHeight || document.body.scrollWidth > document.body.offsetWidth){ // all but Explorer Mac yScroll = document.body.scrollHeight; xScroll = document.body.scrollWidth; } else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari yScroll = document.body.offsetHeight; xScroll = document.body.offsetWidth; } $("#TB_overlay").css({"height":yScroll +"px", "width":xScroll +"px"}); $("#TB_HideSelect").css({"height":yScroll +"px","width":xScroll +"px"}); } function TB_load_position() { var pagesize = TB_getPageSize(); var arrayPageScroll = TB_getPageScrollTop(); $("#TB_load") .css({left: (arrayPageScroll[0] + (pagesize[0] - 100)/2)+"px", top: (arrayPageScroll[1] + ((pagesize[1]-100)/2))+"px" }) .css({display:"block"}); } function TB_parseQuery ( query ) { var Params = new Object (); if ( ! query ) return Params; // return empty object var Pairs = query.split(/[;&]/); for ( var i = 0; i < Pairs.length; i++ ) { var KeyVal = Pairs[i].split('='); if ( ! KeyVal || KeyVal.length != 2 ) continue; var key = unescape( KeyVal[0] ); var val = unescape( KeyVal[1] ); val = val.replace(/\+/g, ' '); Params[key] = val; } return Params; } function TB_getPageScrollTop(){ var yScrolltop; var xScrollleft; if (self.pageYOffset || self.pageXOffset) { yScrolltop = self.pageYOffset; xScrollleft = self.pageXOffset; } else if (document.documentElement && document.documentElement.scrollTop || document.documentElement.scrollLeft ){ // Explorer 6 Strict yScrolltop = document.documentElement.scrollTop; xScrollleft = document.documentElement.scrollLeft; } else if (document.body) {// all other Explorers yScrolltop = document.body.scrollTop; xScrollleft = document.body.scrollLeft; } arrayPageScroll = new Array(xScrollleft,yScrolltop) return arrayPageScroll; } function TB_getPageSize(){ var de = document.documentElement; var w = window.innerWidth || self.innerWidth || (de&&de.clientWidth) || document.body.clientWidth; var h = window.innerHeight || self.innerHeight || (de&&de.clientHeight) || document.body.clientHeight arrayPageSize = new Array(w,h) return arrayPageSize; } Hi guys. I wanted to show you a gallery that I am doing. I'm stuck here with some issue. I've made the gallery with the buttons but now I wanted to add a previous and next button but I not being able to do. all the rest is working. the javascript code is this: Code: $(function () { var imgContainers = $('div.tabs > div'); imgContainers.hide().filter(':first').show(); $('div.tabs ul.number_nav a').click(function () { imgContainers.hide(); imgContainers.filter(this.hash).show(); $('div.tabs ul.number_nav a').removeClass('selected'); $(this).addClass('selected'); return false; }).filter(':first').click(); }); the html file is this: Code: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <title>gallery</title> <!--CSS--> <link href="style.css" rel="stylesheet" type="text/css" /> <!--JavaScript--> <script type="text/javascript" src="jquery-1.4.2.js"></script> <script type="text/javascript" src="code.js"></script> </head> <body> <div id="gallery"><!--IMG CONTAINER START --> <div class="tabs"> <div id="image_01"> <div class="image"> <img src="image_one.png" width="795" height="395" /> </div> </div> <div id="image_02" > <div class="image"> <img src="image_two.png" width="795" height="395" /> </div> </div> <div id="image_03"> <div class="image"> <img src="and_so_on.png" width="795" height="395" /> </div> </div> <ul class="number_nav"> <li><a href="#image_01">01</a></li> <li><a href="#image_02">02</a></li> <li><a href="#image_03">03</a></li> </ul> <ul class="prev_next_nav"> <li><a href="#">Previous</a></li> / <li><a href="#">Next</a></li> </ul> </div> </div> </body> </html> here is the zip file: http://www.sendspace.com/file/we3lkd can someone help me to make the code to the previous / next code please? I'm not very good ( nothing at all ) with javascript... Plz i want to make a photo gallery of many images... i want it to be enlarged with an effect.. i have a thumbnails images and large images i want the thumbnails to be enlarged with any effect and to be displayed on the same page .. can anyone send for me a new photo gallery effect? Hi I want to create an image gallery which has one main image (large size) with a series of smaller thumbnail images below. When you click on one of the smaller images below, I need it to load it into the space above. This series of images will be selected by a PHP script and a MySQL database. The ratios of the images will not always be the same, so the boundry box will need to change width and height accordingly. This will change the height of the page too I guess. Now, the real fly in the ointment is that I really would like the main image to have a drop shadow (gradient based) on all 4 sides of the image. So, good people of the JS Sub-Forum - whats the best way to get this done?! Cheers The Moose Hey all, I'm designing a website and i'm doing a section on a portfolio of artwork. wat i would like is to group the work under different headings and for each group to have a thumbnail of an image. when that image is clicked a window is opened which displays all the works in that group as thumbnails as well as an image gallery (larger image of the current image and being able to click on the other thumbnails to view a larger image of it). hope that makes sense. I've been searching all over for scripts bit nothing fits my criteria exactly. going a bit crazy over this, any help or direction much appreciated. peace Hey all, Effectively what I want is a table displaying 20 thumbnails and above the table to be a large image. When a user clicks a thumbnail I want a relative image to be displayed above. Now obviously I can just set this to reload the page and load the relative image in its space but I was wondering if there was a way of doing this without having to reload the whole page each time. I also want to avoid Iframes as I want this to be as cross-compatible as possible. Thanks all. Does anyone have a solution? The first image works fine, but obviously when the image is changed by the second function it will not work???? Code: <script type="text/javascript"> jQuery(document).ready(function(){ $("a#single_image").fancybox({ 'transitionIn' : 'elastic', 'transitionOut' : 'elastic', 'speedIn' : 600, 'speedOut' : 200, 'overlayShow' : false }); }); </script> </head> <body> <div class="hidden"> <script type="text/javascript"> $(function() { $(".image").click(function() { var image = $(this).attr("rel"); var large = $(this).attr("title"); $('#image').hide(); $('#image').fadeIn('slow'); $('#image').html('<a href="' + large + '" id="single_image"><img src="' + image + '"/></a>'); return false; }); }); </script> Does anyone know of a good webscript slideshow on a loop that I can use in a website ? www.chagfordshow.com We don’t want a database at the moment. Needs to work in all browsers. What I’m looking for :- Change the image every few seconds. Slip into any element of the webpage. All images will be the same size. Some landscape, some portrait. Looking for this to work all in client’s scripting. or maybe AJAX Thanks. Most grateful if anyone can help Hello, Any suggestions for how to make this sort of gallery - http://www.timsimmons.co.uk/index.php ? I am making a website for a friends degree show and really like the minimal aesthetic. I'm not a fan of the usual JS plugin galleries. One thing I can't work out how they have done is link the text caption above to the images. This has been niggling at me for days! I am new to JS so please go easy on me. Cheers, Andy I've tried hosting my WIP website to see how it works. Everything goes well except for the following: On my Portfolio page: [Portfolio] I have coded a "gallery" in jquery. When the page starts loading it seems that the browser loads the ` Code: #portfolioSlider ` div which is supposed to be display:none until triggered. It contains lots of images resulting in massive load time until the thumbnails ( `#Portfolio` ) starts loading. How can I make the ` Code: #portfolioSlider ` images start loading only after it opens? Thanks in advance! Hi, I started with the template on this site: http://www.pupinc.com/videobox/ However, I have about a dozen videos with more to come so I added a vertical scrollbar to navigate through the thumbnails. My problem is I don't know how to separate the main video player so that it doesn't scroll with the thumbnails. HTML: Code: <div id="middle4"> <div class="videobox" style="height: 360px; overflow-y: scroll;"> <ul> <li><a href="http://www.youtube.com/watch?v=iFGEHtqNZis">TRS 50X35</a></li> <li><a href="http://www.youtube.com/watch?v=9CaN2KBYpo8">98X104 Automobile Shredder</a></li> <li><a href="http://www.youtube.com/watch?v=BWHXX6u3tVk">60x60 Aluminum</a></li> <li><a href="http://www.youtube.com/watch?v=ZiWDKtdfqWQ">60X60 System</a></li> <li><a href="http://www.youtube.com/watch?v=VMbbXcFju9E">Portable Shredding System</a></li> <li><a href="http://www.youtube.com/watch?v=WEn5xtJwtu4">60X85 System</a></li> <li><a href="http://www.youtube.com/watch?v=1cOxYQB5icg">60X60 White Goods</a></li> </ul> </div> </div> JS: Code: // Videobox object VideoBox = Class.create(); VideoBox.prototype = { // Initialize object. initialize: function(index, item) { this.index = index; this.item = item; this.item.addClassName('videoboxjs'); this.list = this.item.getElementsBySelector('ul')[0]; // Create div.bigvideo and add it just before the ul. this.bigvideo = document.createElement('div'); Element.addClassName(this.bigvideo, 'bigvideo'); this.item.insertBefore(this.bigvideo, this.list); // Create array of videothumbs. this.thumbs = new Array; // Opera 9 doesn't like 'li a' in getElementsBySelector, so you // have to break it apart. var links = this.item.getElementsBySelector('li'); for (var i=0; i < links.length; i++) { this.thumbs[i] = new VideoThumb(index, i, links[i].getElementsBySelector('a')[0]); } // Load up the first video. this.swap(0); }, // Replace existing video with new one. swap: function(index) { // IE 6 won't show the video unless something else is in the box. // I chose to add a <br /> which I hide via CSS. this.bigvideo.innerHTML = '<br /><object width="425" height="350"><param name="movie" value="' + this.thumbs[index].video + '"></param><param name="wmode" value="transparent"></param><embed src="' + this.thumbs[index].video + '" type="application/x-shockwave-flash" wmode="transparent" width="425" height="350"></embed></object>'; // Deselect all the thumbnails. this.thumbs.invoke('deselect'); // Select the current thumbnail. this.thumbs[index].select(); } }; // Videothumb object VideoThumb = Class.create(); VideoThumb.prototype = { // Initialize object. initialize: function(boxindex, index, link) { this.boxindex = boxindex; this.index = index; this.item = link; this.href = this.item.getAttribute('href'); // Extract the v querystring value from the href. Youtube uses this // value for everything. this.videocode = this.href.toQueryParams().v; // Direct link to the video for use in the object/embed this.video = 'http://www.youtube.com/v/' + this.videocode; // Create thumbnail image and append it inside the list item var img = document.createElement('img'); img.src = 'http://img.youtube.com/vi/' + this.videocode + '/default.jpg'; img.alt = this.item.innerHTML; img.title = this.item.innerHTML; this.item.innerHTML = ""; this.item.appendChild(img); // Observe the click event. Event.observe(this.item, 'click', this.swap.bindAsEventListener(this)); }, swap: function(evt) { // Call the swap method of the parent videobox with the thumbnail // thumbnail index as a parameter. aVB[this.boxindex].swap(this.index); // Stop the event so the browser doesn't follow the link. if (evt) { Event.stop(evt); } }, select: function() { this.item.addClassName('current'); }, deselect: function() { this.item.removeClassName('current'); } }; // Don't do anything if we're using Opera 8 or earlier. if (!Prototype.Browser.Opera || (Prototype.Browser.Opera && navigator.userAgent.toLowerCase().charAt(navigator.userAgent.toLowerCase().indexOf('opera') + 6) > 8)) { // Create array of videoboxes so you can have more than one on a page. var aVB = new Array; $$('div.videobox').each ( function(videobox, index) { aVB[index] = new VideoBox(index, videobox); }); } Hello guys, I spent a lot of time searching for a good image/video gallery, but didn't find, what I'm looking for. All I need is a code, that I can insert to my webpage. I need a thumbnail gallery (images or videos), that I can scroll by next/previous buttons a open it by clicking in new window. This is how LightBox and VideoLightBox work, but they don't have the next/previous buttons. I found js ImageScroller, but it can't work together with VideoLightBox... Is there anybody solving this problem? Well I found this page http://codecanyon.net/item/jquery-ho...preview/112734 but I need it even for videos. If there is a solution for both images and videos... Thanks for help, DveD |