Jump to content

Search the Community

Showing results for tags 'Jquery'.



More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • W3Schools
    • General
    • Suggestions
    • Critiques
  • HTML Forums
    • HTML/XHTML
    • CSS
  • Browser Scripting
    • JavaScript
    • VBScript
  • Server Scripting
    • Web Servers
    • Version Control
    • SQL
    • ASP
    • PHP
    • .NET
    • ColdFusion
    • Java/JSP/J2EE
    • CGI
  • XML Forums
    • XML
    • XSLT/XSL-FO
    • Schema
    • Web Services
  • Multimedia
    • Multimedia
    • FLASH

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Location


Interests


Languages

Found 286 results

  1. hey guys Basically i am trying to create a validation for the form. I want it to check if it can connect to the DB and if true to proceed to another page and if false to return an error. I am inputting the wrong details to make it just display the error but somehow it always returns "TRUE" on page load... and everytime i click the submit it doesnt do anything regardless of my entry... Can anyone tell me why? <script type="text/javascript" src="http://code.jquery.com/jquery-latest.js"></script> <script> $(document).ready(function(){var u = $('#username');var s = $('#server');var p = $('#password'); $('#iValForm').submit($.post("connect.php", {u: u.val(),p: p.val(),s: s.val()}, function(fd){ if (fd == "true"){ alert("Is: " + fd); return false; } // if1 if (fd == "false"){ alert("Is2: " + fd); return false; } // if2} //post function) //Post) //submit }) //document </script></head> <body> <form class="iValForm" id="iValForm" method="post" action=""><fieldset><legend id="error"> </legend><p><label for="username">Username </label><input id="username" name="username" class="required" /> </input></p><p><label for="password">Password</label> <input id="password" name="password" class="required"/> </input></p><p><label for="server">Server</label> <input id="server" name="server" class="required"/> </input></p><p> <input class="submit" id ='submit' type="submit" value="Submit"/></p></fieldset></form> connect.php <?php$user = $_POST['u'];$password = $_POST['p'];$server = $_POST['s'];@$con = mysql_connect ($server, $user, $password); if (!$con) {$response = 'false';echo $response;} else { $response = 'true'; echo $response;}?>
  2. Hello! I'm new here and I am dealing with a little problem which I hope you guys can help me with! What I want to achieve: Basically what I want to happen is that when the logo gets hovered the black message box will fade in using css transitions. Take a look at the image below and you will get me. And when the mouse moves away from the logo the message box fades out to zero again. But something is wrong, I dont know what. https://docs.google.com/file/d/0B0ONzhkyFUwhQXNOTFJzb0lVSFE/edit?pli=1 <-- image to make you understand. What I am dealing with: Thanks for staying with me, here is my HTML, CSS AND jQuery HTML: <div id="colume"> <div id="logo-to-hover"><a href="#"><img src="images/villave-logo.png" alt="villave-logo" width="220" height="53" /></a> </div> <!-- end logo-to-hover--> </div> <!-- end colume--> <div id="message"> <div id="box-1" class><p>Byggvareforhandler</p> </div> <!-- end box1 --> </div><!-- end message--> jQuery: <script>$(function() { $( "#logo-to-hover" ).hover(function() { $( "#box-1" ).toggleClass( "box-a"); return false; });}); </script> CSS: #logo-to-hover { width: 220px; height: 55px; margin-right: 20px; float: left; } #boxes { width: 940px; height: 71px; margin-left: auto; margin-right: auto; position: absolute; } #box-1 { height: 44px; width: 200px; margin-left: 10px; margin-right: 10px; background-image: url(../images/hoverbg.png); float: left; text-align: center; opacity: 0; -webkit-transition: all 0.4s ease-in-out;-moz-transition: all 0.4s ease-in-out;-o-transition: all 0.4s ease-in-out;-ms-transition: all 0.4s ease-in-out;transition: all 0.4s ease-in-out; }.box-a { opacity: 1; -webkit-transition: all 0.4s ease-in-out;-moz-transition: all 0.4s ease-in-out;-o-transition: all 0.4s ease-in-out;-ms-transition: all 0.4s ease-in-out;transition: all 0.4s ease-in-out; }
  3. I'm using Firefox 13.0.1. In my local WAMP jPlayer video is playing perfectly.I'm using webm file. So it should work on live server firefox as well. But instead of firefox it works fine in Chrome. videoPlaylist = new jPlayerPlaylist({ jPlayer: "#jquery_jplayer_1", cssSelectorAncestor: "#jp_container_1" }, [{ webmv: "video.webm" }], { swfPath: "js", autoPlay: false, supplied: "webmv", wmode: "window", size: { width: "440px", height: "270px", cssClass: "jp-video-270p" } }); swf path is correct. Flash in installed on server. Because audio player works fine in firefox.Can anyone point what i'm missing?
  4. So I have a standard two level menu in one php file that I show on all the pages on a website. The menus and submenus are nested <ul> elements. When you go to a page, I would like the submenu that includes that page to be open by default. And also to stay open if another submenu isn't hovered over. I think I can figure out the menu transformations. The part I need help on is finding the submenu that the active page is contained in so I can set that one to be open.
  5. Hey! I'm working on an custom map, i have the map from google and altert the style it all works.But i would like to show a HTML5 movie in an overlapping div and then fade it out afer it is finished.This is what i got so far: Jquery: <script type="text/javascript">$('#soundlogo').delay(400).fadeOut(400);</script> CSS: #soundlogo { height:100%;width:100%;display:block; background-color:#FFF;position:fixed;z-index:100;} body: <body onload="initialize()"> <div id="soundlogo"> <video width="100%" autoplay> <source src="video/soundlogo-web.mp4" type="video/mp4" /> Your browser does not support the video tag.</video> </div><div id="nav"><strong>Mode of Travel: </strong><select id="mode" onchange="calcRoute();"> <option value="DRIVING">Driving</option> <option value="WALKING">Walking</option> <option value="BICYCLING">Bicycling</option></select></div> <div id="map_canvas" style="width:100%; height:100%"></div> </body> Problem is that the fade never occurs,thanks in advance!
  6. In the name of GOD hi guys:which one is most important javascript , jquery or ajax ?for learning JQuery is necessary learning something befor learning JQuery for example javascript or ....?Do you know some books for Beginners ?Thanks for your helping.
  7. http://superdit.com/2011/08/11/23-slider-with-pricing-design-showcase/ ^ How to produce that? is there already something like that in jquery? If so please let me know or give a constructive suggestion that can help :s Thank you
  8. I have two different plugins in my page but they don't work together. http://www.wedub4u.com/es/inicio_es.html Any ideas how to make them work? This is the relevant code: <head><link rel="stylesheet" type="text/css" href="http://wedub4u.com/style2.css" /> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.0/jquery.min.js"></script><script type="text/javascript" src="js/jquery.jqDock.min.js"></script><script type="text/javascript">$(function(){var jqDockOpts = {align: 'left', duration: 200, labels: 'tc', size: 48, distance: 85};$('#jqDock').jqDock(jqDockOpts);});</script> <script type="text/javascript" src="http://wedub4u.com/js/simplegallery.js"></script> </head> <!-- BEGIN DOCK 1 ============================================================ --><div id="dockContainer"><ul id="jqDock"><li><a class="dockItem" href="http://wedub4u.com/es/inicio_es.html"><img src="http://wedub4u.com/images/icons/menu1/homesm.png" alt="inicio" title="Inicio" /></a></li> <li><a class="dockItem" href="#map"><img src="http://wedub4u.com/images/icons/sitemap.png" alt="mapa del sitio web" title="Mapa Web"/></a></li> <li><a class="dockItem" href="http://wedub4u.com/es/inicio_es.html"><img src="http://wedub4u.com/images/icons/about.png" alt="información" title="Info"/> </a></li> <li><a class="dockItem" href="http://wedub4u.com/es/inicio_es.html"><img src="http://wedub4u.com/images/icons/menu1/portfsm.png" alt="galerias" title="Galerías"/> </a></li> <li><a class="dockItem" href="#contact"><img src="http://wedub4u.com/images/icons/menu1/email2sm.png" alt="contacto" title="Contacto"/> </a></li> <li><a class="dockItem" href="http://wedub4u.com/es/inicio_es.html"><img src="http://wedub4u.com/images/icons/menu1/dealssm.png" alt="ofertas" title="Ofertas"/> </a></li> <li><a class="dockItem" href="http://wedub4u.com/es/inicio_es.html"><img src="http://wedub4u.com/images/icons/menu1/storesm.png" alt="tienda" title="Tienda"/> </a></li> </ul> </div><!--end div .dock #dock--> <!-- END DOCK 1 ============================================================ --> <div id="slider"> <!--* Simple Controls Gallery- © Dynamic Drive DHTML code library (www.dynamicdrive.com)* This notice MUST stay intact for legal use* Visit Dynamic Drive at http://www.dynamicdrive.com/ for this script and 100s more--> <div id="simplegallery1"><script type="text/javascript">var mygallery=new simpleGallery({wrapperid: "simplegallery1", //ID of main gallery container,dimensions: [1020, 600], //width/height of gallery in pixels. Should reflect dimensions of the images exactlyimagearray: [["http://wedub4u.com/images/slider/4.png", "", "_new", ],["http://wedub4u.com/images/slider/1.png", "", "_new", ],["http://wedub4u.com/images/slider/2.png", "", "_new", ],["http://wedub4u.com/images/slider/3.png", "", "_new", ],["http://wedub4u.com/images/slider/4.png", "", "_new", ],["http://wedub4u.com/images/slider/1.png", "", "_new", ],["http://wedub4u.com/images/slider/2.png", "", "_new", ],["http://wedub4u.com/images/slider/3.png", "", "_new", ],["http://wedub4u.com/images/slider/4.png", "", "_new", ],["http://wedub4u.com/images/slider/1.png", "", "_new", ],["http://wedub4u.com/images/slider/2.png", "", "_new", ],["http://wedub4u.com/images/slider/3.png", "", "_new", ], ],autoplay: [true, 2500, 10], //[auto_play_boolean, delay_btw_slide_millisec, cycles_before_stopping_int]persist: false, //remember last viewed slide and recall within same session?fadeduration: 2000, //transition duration (milliseconds)oninit:function(){ //event that fires when gallery has initialized/ ready to run//Keyword "this": references current gallery instance (ie: try this.navigate("play/pause"))},onslide:function(curslide, i){ //event that fires after each slide is shown//Keyword "this": references current gallery instance//curslide: returns DOM reference to current slide DIV (ie: try alert(curslide.innerHTML)//i: integer reflecting current image within collection being shown (0=1st image, 1=2nd etc)}}) </script></div> </div> <!--end div slider--> <div id="logodinamic"><script type="text/javascript">var mygallery=new simpleGallery({wrapperid: "logodinamic", //ID of main gallery container,dimensions: [230, 125], //width/height of gallery in pixels. Should reflect dimensions of the images exactlyimagearray: [["http://wedub4u.com/images/textlogo/log11.png", "", "_new", ],["http://wedub4u.com/images/textlogo/log21.png", "", "_new", ],["http://wedub4u.com/images/textlogo/log31.png", "", "_new", ],["http://wedub4u.com/images/textlogo/log41.png", "", "_new", ],["http://wedub4u.com/images/textlogo/log11.png", "", "_new", ],["http://wedub4u.com/images/textlogo/log21.png", "", "_new", ],["http://wedub4u.com/images/textlogo/log31.png", "", "_new", ],["http://wedub4u.com/images/textlogo/log41.png", "", "_new", ],["http://wedub4u.com/images/textlogo/log11.png", "", "_new", ],["http://wedub4u.com/images/textlogo/log21.png", "", "_new", ],["http://wedub4u.com/images/textlogo/log31.png", "", "_new", ],["http://wedub4u.com/images/textlogo/log41.png", "", "_new", ],],autoplay: [true, 2500, 10], //[auto_play_boolean, delay_btw_slide_millisec, cycles_before_stopping_int]persist: false, //remember last viewed slide and recall within same session?fadeduration: 2000, //transition duration (milliseconds)oninit:function(){ //event that fires when gallery has initialized/ ready to run//Keyword "this": references current gallery instance (ie: try this.navigate("play/pause"))},onslide:function(curslide, i){ //event that fires after each slide is shown//Keyword "this": references current gallery instance//curslide: returns DOM reference to current slide DIV (ie: try alert(curslide.innerHTML)//i: integer reflecting current image within collection being shown (0=1st image, 1=2nd etc)}}) </script></div>
  9. I created a web page in which the logo is a slide show that changes in color according to the picture that is on the main slide show. http://www.wedub4u.com/ But when the effect is lost if both slideshows don't start at the same time. And the first time the bigger slide show requires more time to preload the images. Any ideas in how to sync both slideshows so they start at the same time?
  10. I am now familiar with the existence of the ".draggable()" function of jQuery. I am mulling over how I would integrate the dragging and dropping of an element into an event listener like this one: google.maps.event.addListener(myMap, 'click', function(myEvent){var myClickLatLng=myEvent.latLng;// now process myClickLatLng}); First I am wondering if the dragging and dropping of an element would constitute a 'click' and second if the click event is fired how am I to know which element was dropped? Again I thank all of you for your time and wisdom. I am hoping my post is in the right forum as this is for JavaScript which is closely related. Thank You!
  11. I created a fisheye menu and it was working well, until I added an autoslider that uses a different JQuery library version.Now the slider works, but not the fisheye menu. I tried adding the NoConflict, but it didn't work. This is my website: http://www.wedub4u.com/ This is the relevant code at the head of my document: <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js">var jq132 = jQuery.noConflict();</script><script type="text/javascript" src="js/fisheye-iutil.min.js">var jq132 = jQuery.noConflict();</script><script type="text/javascript" src="js/dock-example1.js">var jq132 = jQuery.noConflict();</script> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.0/jquery.min.js">var jq160 = jQuery.noConflict();</script><script type="text/javascript" src="js/simplegallery.js">var jq160 = jQuery.noConflict();</script> <!--* Simple Controls Gallery- © Dynamic Drive DHTML code library (www.dynamicdrive.com)* This notice MUST stay intact for legal use* Visit Dynamic Drive at http://www.dynamicdrive.com/ for this script and 100s more--> <script type="text/javascript">var jq160 = jQuery.noConflict();var mygallery=new simpleGallery({wrapperid: "simplegallery1", //ID of main gallery container,dimensions: [1020, 600], //width/height of gallery in pixels. Should reflect dimensions of the images exactlyimagearray: [["http://wedub4u.com/images/slider/1.png", "http://wedub4u.com/index.html", "_new", "description"],["http://wedub4u.com/images/slider/2.png", "http://wedub4u.com/index.html", "_new", ],["http://wedub4u.com/images/slider/3.png", "http://wedub4u.com/index.html", "_new", ],["http://wedub4u.com/images/slider/4.png", "http://wedub4u.com/index.html", "_new", "description"]],autoplay: [true, 2500, 10], //[auto_play_boolean, delay_btw_slide_millisec, cycles_before_stopping_int]persist: false, //remember last viewed slide and recall within same session?fadeduration: 2000, //transition duration (milliseconds)oninit:function(){ //event that fires when gallery has initialized/ ready to run//Keyword "this": references current gallery instance (ie: try this.navigate("play/pause"))},onslide:function(curslide, i){ //event that fires after each slide is shown//Keyword "this": references current gallery instance//curslide: returns DOM reference to current slide DIV (ie: try alert(curslide.innerHTML)//i: integer reflecting current image within collection being shown (0=1st image, 1=2nd etc)}}) var jq132 = jQuery.noConflict(); </script> And this is the code at the body for both elements:Fisheye Menu <!-- BEGIN DOCK 1 ============================================================ --><div id="dock"> <div class="dock-container"> <a class="dock-item" href="index.html"> <span>Home</span> <img src="http://wedub4u.com/images/icons/menu1/homesm.png" alt="home"/> </a> <a class="dock-item" href="#map"> <span>Sitemap</span> <img src="http://wedub4u.com/images/icons/sitemap.png" alt="sitemap"/> </a> <a class="dock-item" href="index.html"> <span>About</span> <img src="http://wedub4u.com/images/icons/about.png" alt="about"/> </a> <a class="dock-item" href="index.html"> <span>Portfolio</span> <img src="http://wedub4u.com/images/icons/menu1/portfsm.png" alt="portfolio"/> </a> <a class="dock-item" href="#contact"> <span>Contact</span> <img src="http://wedub4u.com/images/icons/menu1/email2sm.png" alt="contact"/> </a> <a class="dock-item" href="index.html"> <span>Promotions</span> <img src="http://wedub4u.com/images/icons/menu1/dealssm.png" alt="deals"/> </a> <a class="dock-item" href="index.html"> <span>Store</span> <img src="http://wedub4u.com/images/icons/menu1/storesm.png" alt="store"/> </a> </div><!--end div .dock-container--></div><!--end div .dock #dock--><!-- END DOCK 1 ============================================================ --> SLIDER <div id="slider"> <div id="simplegallery1"></div> </div> <!--end div slider--> Any suggestions?
  12. Hi folksI'm trying to initiate a click event (and subsequent image fade in) when a user clicks on a thumbnail. That in itself isn't such a problem. The problem lies in the fact that the thumbnails are contained in an array and are displayed with an append within an each loop (see code below). I've gotten halfway there, the code below does initiate a fade in when a thumbnail is clicked - however, it fades in all the images as opposed to just the one relating to the thumbnail that is clicked on. I know this is because by the time the #test append happened all the images have loaded so it just displays all of them. The question is, how can I get it to just display the full image related to the thumbnail that's been clicked on? I'm pretty new to this so apologies if this seems a bit pedestrian. Thanks in advanceStef For reference purposes:array[0] refers to id of imagearray[6] is the thumbnail urlarray[7] is the full image urlarray[8] & array[9] are x and y coordinates of the thumbnail on the page function display (array) { $.each(array, function(i){ $('#container').append( '<div id="'+array[i][0]+'" style="position: absolute; left:'+array[i][8]+'px; top: '+array[i][9]+'px;"><img src=images/'+array[i][6]+' id=nav width=85 height=85></div>' ); $('#test').append( '<div id="'+array[i][0]+'" style="width: 398px;"><img src=images/'+array[i][7]+' id=nav width=398>' ); $("#"+array[i]).click(function () { $("#test").fadeIn('slow', function () {// animation complete}); }); });} Full page attached upload.php
  13. Guest

    Jparallax jquery no movement

    Hi I am new to jquery and jparallax.I have been following the tutorials on the jparallax page: http://webdev.stephband.info/parallax.htmland been looking at the source of demo: http://webdev.stephband.info/parallax_demos.htmland have been trying to implement this into a site I am creating for a friend. My parallax attempt can be found here: http://greenavenueshull.atwebpages.com/parallax.html If you look at the source it is all pretty self explanatory.The images "bf01.png" and "bf02.png" are the 2 butterflies, 01 being blue, 02 being purple, they are both right by each other but as you can see only the blue butterfly is visible, and it does not move a lá parallax. I have been reading and writing and rewriting...I just cant see what I am doing wrong. Can anybody please help?
  14. I want to define http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js as $jquerylink in a variable, so that I can link them by just typing $jquerylink.
  15. Hello all, I developed pop-out slider menu that builds itself from the CSS rules and HTML content. Unfortunately I designed it around a $('.menuElement .uniqueMenuClass') strategy. Basically I have a handful of menus that do the same thing but with multiple copies of the pop-out menu script plugin with renamed '.uniqueMenuClass' for the respective menus. Example: $('.sliderMenu .menuOne').ready(function buildSlider(){ var sliderWidth = $('.sliderMenuElement .menuOne').width(); // A series of CSS dependent variables... $('.sliderMenuElement .menuOne').mouseenter(function animatedStuff(){ //series of animations triggered });} I'd then go back and copy/paste the whole thing with .menuTwo. Stupid, I know. Now, I'm trying to do something like this... $('.sliderMenu').ready(function buildSlider(){ var sliderWidth = $(this).find('.sliderMenuElement').width(); //Series of CSS dependencies... $(this).find('sliderMenuElement').mouseenter(function animatedStuff(){ //series of animations triggered });}); The problem is that .find() runs through ALL of the menuSlider's. Should I assign a unique ID to the menus and all their descendants and store the ID in all the variables and functions? Is there a way to traverse just within the $(this) element? or clear all the variables so the next menu starts clean-slate? Is this why I should have structured with lists instead of nested divs? Children aren't practical because I'm accessing a number of elements at different levels in the tree; the examples above are very simplified. Appreciate the help! Here's a link to a test version... which takes a while to load because of the multiple script references: www.jaredadradtke.com/testersite/index.html And please no comments on the reel labeled 'webdesign' Also... here's an example of the HTML: <div class="autoSlider"> <div class="slideCont" style="top:0px;"> <div class="sliderName">Reels</div> <div class="sliderInitial"> <div class="slideEndCap leftCap"></div> <div class="slideEndCap rightCap"></div> <div class="thumbCont reels"> <div class="slideThumb reels"> <span class="thumbCaption">Motion Design</span> </div> <div class="slideThumb reels"> <span class="thumbCaption">Cinematography</span> </div> <div class="slideThumb reels"> <span class="thumbCaption">Web Design</span> </div> <div class="slideThumb reels"> <span class="thumbCaption">Color Grading</span> </div> </div> </div> </div></div>
  16. Okay, I understand what it does, but I'm having troubles understanding the process of the set/getCookie functions given as examples in the w3schools tutorial.I'm a jQuery junkie trying to ramp up to serious scripting (eventually with Ajax and PHP as its becoming apparent). While the school lessons have been invaluable I notice they don't always have a comprehensive list of objects, methods, or actions that can be done. For instance in the Cookie examples, how where does 'exdays' get defined, what do escape() and unescape() do, etc. I understand parts but others seem completely unexplained. Are there any more comprehensive explanations of the cookie?Also, another example, they talk about the setTimeout and clearTimeout, but I never saw setInterval anywhere... that seems like an important thing to leave out of the school so I'm assuming there's 'gotta be a site out there where a full list of events and objects is being updated more regularly.Thanks!
  17. Hello All, So you frequently see reductions with commonly used objects such as: var $this = $(this)//Or....var $objectName = $('.className') Is there any places or reason why you would chose to use the $ before the var name to create an object as oppose to just making a normal variable? I'm looking to find and replace the objects with these sorts of variables to reduce file size, make it easier to read, and hopefully speed up load time but to check with experts before I potentially F#$! up my work. Thoughts? Also, any thoughts on how to structure code (in general) to run most efficiently would be helpful. I auditioned a very scant, un-skinned version of my page on the server and it took much longer than I expected to load (on my itty bitty netbook of which I think some cell phones have more processing power). Thanks!
  18. I'm not sure if this is the best place to ask this, but I'm not sure which section it fits best under. I've been asked to build a site that smoothly scrolls content and I don't know where to start. I'm trying to build something like the top part of this site where you click on the arrows and it scrolls to another set of stories. I've tried to disect the code on the site, but when I try to implement it myself it doesn't work. I pressume it's some sort of jquery plugin but that's as far as I've got with it. I'd be grateful for any help on this as I've been trying to work it out for months and haven't got anywhere - except now have less hair!! Thanks.
  19. Okay, here is the problem, the background to it is a little bit lengthy but please bear with me as I think it's probably essential to getting to the root of it. I'm trying to design an on-site navigation system using straight javascript and jquery. The site is for a photographer who has a number of galleries of her images she wants to put up. These are displayed on the page as a series of thumbnails which are arranged in a grid (lets say 3 by 3 here for simplicity's sake). The idea is that these can either be displayed in order of size or in order of the date the gallery was updated. There are two buttons at the top of the page 'size' and 'date' and whenh one of these is clicked the thumbnails should animate into the new position. I've reduced the arrays to their essential parts for the purposes of this question. They're defined in the header of the page as follows: //order: id, gallery size, gallery date (UK format), thumbnail url. x position (px), y position (px) var galDate = new Array();galDate[0] = [0, 7, 12-2-2012,"images/image5.jpg", 100, 100]; galDate[1] = [6, 2, 1-2-2012,"images/image0.jpg", 200, 100]; galDate[2] = [4, 10, 24-1-2012,"images/image8.jpg", 300, 100]; galDate[3] = [9, 3, 11-12-2011,"images/image7.jpg", 100, 200]; galDate[4] = [7, 14, 4-8-2011,"images/image6.jpg", 200, 200]; galDate[5] = [2, 32, 3-8-2011,"images/image3.jpg", 300, 200]; galDate[6] = [8, 11, 10-6-2011,"images/image2.jpg", 100, 300]; galDate[7] = [5, 5, 1-6-2011,"images/image1.jpg", 200, 300]; galDate[8] = [3, 7, 3-4-2011,"images/image4.jpg", 300, 300]; var galSize = new Array();galSize[0] = [2, 32, 3-8-2011,"images/image3.jpg", 300, 200]; galSize[1] = [7, 14, 4-8-2011,"images/image6.jpg", 200, 200]; galSize[2] = [8, 11, 10-6-2011,"images/image2.jpg", 100, 300]; galSize[3] = [4, 10, 24-1-2012,"images/image8.jpg", 300, 100]; galSize[4] = [3, 7, 3-4-2011,"images/image4.jpg", 300, 300]; galSize[5] = [0, 7, 12-2-2012,"images/image5.jpg", 100, 100]; galSize[6] = [5, 5, 1-6-2011,"images/image1.jpg", 200, 300]; galSize[7] = [9, 3, 11-12-2011,"images/image7.jpg", 100, 200]; galSize[8] = [6, 2, 1-2-2012,"images/image0.jpg", 200, 100]; Displaying the thumbnails and the animation is handled by three functions: which are defined in the <head> section of the page as follows: 'Swap' loops through the all the rows in array 1 defining the id, x position and y position as variables id1, x1 and y1 (please forgive the 'document writes' this was part of an earlier debugging attempt) function swap(array1, array2){for(i=0; i<array1.length; i++){var id1 = array1[0];document.write ('id1: ' + id1);document.write ('<br />');var x1 = array1[3];document.write ('x1: ' + x1);document.write ('<br />');var y1 = array1[4];document.write ('y1: ' + y1);document.write ('<br />'); // For each row in the first array, 'Swap' then loops through the second array. When the ids are equal, this triggers the 'animate' function, which then should handle the actual animation for(j=0; j<array2.length; j++){var id2 = array2[j][0];document.write ('id2: ' + id2 );document.write ('<br />');var x2 = array2[j][3];document.write ('x2: ' + x2 );document.write ('<br />');var y2 = array2[j][4];document.write ('y2: ' + y2 );document.write ('<br />'); if (id2==id1){animate(x2, y2);} //close if else {document.write('for loop i should continue');document.write ('<br />'); } } //close for j } // close for i } // close function // 'Animate' is triggered when the ids from each of the arrays correspond and performs the animation (nb – this isn't working perfectly at the moment but the basic animation functionality is working – getting the right thumbnals to animate to the right places is something I have to come back to but its not the main problem at the moment). function animate(x2, y2){$("#"+i).animate({left:x2, top:y2},"slow");document.write ('animate function triggered');document.write ('<br />');} // The actual displaying of the thumbnails is handled by a third function called, surprisingly, 'display' which is as follows. function display (array) {for (i=0, max = array.length; i<max; i++){ $('#container').append('<div id="'+array[0]+'" style="position: absolute; left:'+array[6]+'px; top: '+array[7]+'px;"><a href="#"><img src='+array[5]+' height=75px width=75px></a></div>');}} I have all of the above in the this order in the header of the page. Finally, I have the jquery click function call which is as follows: $(document).ready(function() {$('#size').click(function() {swap (galSize, galDate);}); $('#date').click(function() {swap (galDate, galSize);}); display(galDate); }); The body of the page is as follows: <body><button id="size">Size</button> <button id="date">Date</button><div id="container"></div><script>display (galDate);</script></body> Just to be clear, I realise that some of the actual functionality isn't going to churn out the desired result in terms of positioning etc. The fact of the matter though is that the 'swap' function works in as far as it animates the images (I know because I've tested it!) :-) The problem I have (and thanks to those who've stayed with me thus far!) is that as soon as I click on one of the buttons (size or date) the displayed thumbnails disappear. The swap function is still working because all the 'document writes' display on the page and, similarly the animate function is triggered as well. Its just thet there are no thumbnails anymore and they're sort of central to the whole undertaking. As you can probably tell, I'm pretty new to this and there is no doubt an obvious explanation. The thing is, I don;t know what it is. Any ideas or nods in the right direction would be much appreciated. CheersStef
  20. I have a div animated by incremented margin-left when the user clicks a button. I would like to force the animation to stop at a specific margin-left value and callback a different animation. So if the user tries to click too far it prevents them from doing so. Suggestions? I'd like to do it with margin because it'd be easier to edit later, but if I have to use .position.left as a variable, I'll take the code for that just as well. Here's a wacky selector I tried, to no avail, if it helps convey my intention: $('.slidingDiv[style*=margin-left:80px]').stop().animate(.....); I didn't bind it to a .click because I want to be able to stop any-size div at any given point rather than map it out explicitly. Thanks!
  21. Hey All, I'm jumping back into some web design to update personal site (I usually do camera and computer effects so this is always liking diving back into a 12-foot pool at first).I was wondering how to script a jQuery selector so that it would select all other elements in the document that matched that specific class of the object that was clicked. The purpose is to click on a little mini-thumbnail in a slide that would bring up a "gallery widget" with the appropriate photo enlarged and its respective thumbnail in the widget highlighted, rather than just uploading the first in the set. The elements being selected are in an entirely different div/list so they can't be considered children.Do I need to use a variable? If so how (terrible with that part)?All help is greatly appreciated. Thanks! Jared Also, this wont be an issue with other classes being attached, will it?
  22. I've got the simple code to write out the text of the new position of the div: var posTeller = $('.movingDiv').position();$('span').text(posTeller.left) $(".buttonClass").click(function(){ $(".movingDiv").animate({left: '+=20'}, 500,function() { posTeller = $('.movingDiv').position(); $('span').text(posTeller.left); });}); However, I would like to have it update as it's moving. I will need this later so that an 'if' function can catch it at a certain value and stop the animation mid-way and call a new animation. I found the $.throttle plugin but I'm unsure how to implement it based off the examples. The end purpose is preventing a slide of thumbnails from going too far and 'bouncing back'. Throttle Plugin Thanks!
  23. hey all, im really new to this and could really do with some help, it would be hugely appreciated!i have a toggle type setup for a list of live events but i cant seem to find an easier way or cleaner way to use it, any ideas? here is the code im using at the moment, sorry in advance for the way this is done! i need the setup to have neat slide down tables of info. Code as follows: <script type="text/javascript">// <![CDATA[var Current = "Div1";function Toggle(obj) {if(Current != obj) {document.getElementById(Current).style.display = "none";document.getElementById(obj).style.display = "block";Current = obj;}}// ]]></script><p style="text-align: center;"><em><strong><span style="background-color: #ffffff;"><a href="#" onclick="Toggle('Div1'); return false;"><span style="background-color: #ffffff;">Monday</span></a> | <a href="#" onclick="Toggle('Div2'); return false;"><span style="background-color: #ffffff;">Tuesday</span></a> | <a href="#" onclick="Toggle('Div3'); return false;"><span style="background-color: #ffffff;">Wednesday</span></a>| <a href="#" onclick="Toggle('Div4'); return false;"><span style="background-color: #ffffff;">Thursday</span></a>| <a href="#" onclick="Toggle('Div5'); return false;"><span style="background-color: #ffffff;">Friday</span></a> | <a href="#" onclick="Toggle('Div6'); return false;"><span style="background-color: #ffffff;">Saturday</span></a> | <a href="#" onclick="Toggle('Div7'); return false;"><span style="background-color: #ffffff;">Sunday</span></a></span></strong></em></p><div id="Div1" style="display: none;"><table border="0" rules="all" align="center"><tbody> For some reason when i click monday it actually does nothing, but if i click tuesday, then monday the info is there??
  24. Hello,I'm using this script right now:mainpage.php <?php$mainpage = 'secret';?><a href="#" id="renamegroups">Rename groups</a><div id='renamegroupsl'></div> <script type="text/javascript">$('#renamegroups').click(function(){ $("#renamegroupsl").load("../information/renamegroups.php"); return false;});</script> renamegroups.php <?phpecho $mainpage;?> The problem is that I get this error:Notice: Undefined variable: mainpage in (...)So how could I include a file with ajax / jquery (because if I include the file this will work and the error won't show up) Thanks!
  25. Whats the best solution for completing this:http://app4.websitetonight.com/projects/2/3/9/4/2394058/Tools_for_Web_Success2.htmlthe website I'm working on.scroll down a bit and click the H4 there's a hidden content that slides out.but when multiple on page, it unfolds them all. whats my best option.the reason it opens both is because their both set to the same ID's. and i know that if i set all divs different ID's it will work. BUT what are my other options? are there any other options?here's the code:http://jsfiddle.net/attilahajzer/zx2dk/2/Please Help.
×
×
  • Create New...