Jquery :: Swap Out Div With Div In Href?
Sep 26, 2011I just need to replace a DIV with another DIV on mouse click.I'm assuming the best way to do this is with replaceWith().[code]
View 6 RepliesI just need to replace a DIV with another DIV on mouse click.I'm assuming the best way to do this is with replaceWith().[code]
View 6 RepliesI'm using the following code (simplified version) to call a Json file, parse it and on each iteration, create a div with an ID of "tab". I'm using this with jQuery UI .tab() to create a listing with entries which have three tabs. Anyhow, the principle seems to work except that when I examine what's happening behind the scenes using Firefox console, I see that each href in the html code produced is causing the Json function to re-fire using the href as it's url target.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
[Code].....
i have been tryin for a long time to get both of the javascripts(for the thumbnail to main img swap and the navigational arrow swap) to work in synchit needs to be so that after clicking on a thumbnail then on an arrow, the correct image in the correct order appears. as of now they are running separately and one has no influence on the other. forgive me if im not being clear. i keep trying to replace the id that one script is looking for with the same id from the other but this will not work..why?
View 9 Replies View RelatedI am a complete novice with Javascript, but am trying to work out how I can get a button to swap to another image when clicked, and each image have a different URL attached. I want to use this to toggle the bgcolor of my page using this script:
Code:
<script type="text/javascript">
<!--
function createCookie(name,value,days) {
if (days) {
var date = new Date();
date.setTime(date.getTime()+(days*24*60*60*1000));
var expires = "; expires="+date.toGMTString();
[Code]...
I have a page that is a displaying a Movie, or it's really 3 Movies but to get to the 2nd Movie the user has to click a "Next" button. My problem is that I want to delay this button to appear until the movie is more or less done... could be 7 or 16 minutes. What would be the easiest and most propriate way to do this using jQuery... swaping out one DIV for another once after X minutes?
View 4 Replies View RelatedI have a large div with a Google Map and a much smaller div with Google Streetview. I want the user to be able to click a button and make the large div show the street view and the small div show the map. I'm hoping jQuery can be used to make this 'easy' somehow?
I just don't know how to approach this ..
1) Resize the divs and change z-order?
2) Swap the id of the divs and somehow trigger a refresh?
3) Swap the html using jquery?
i am trying to get each imageloaded into div while mouse over but it does not work. jQuery is new for me what is wrong with jQery code i have no idea could you help please. here is the code.
[Code]...
[URL].. I want the slider's navigation arrows to change on mouse over.Nothing I've tried has worked. In the JS file, I've tried using:<img src="left.png" onmouseover="this.src='left-hover.png'" onmouseout="this.src='left.png'"/>
View 1 Replies View RelatedWhen I mouseover over the list items below, I would like a DIV that I specify (in this case corresponding by number - but I would like the flexibility to define the div name individually if numbers don't exist, or don't match up [I'm using Drupal, and everything is dynamically generated]) to slide out, or just appear, beneath it (the list will be inline). It needs to stay open so people can click the link that appears in the DIV, but when you mouseout from the DIV or the list item, the div needs to disappear.
My HTML looks more like this:
<div
id
=
"navigation"
[Code]....
I'm not familiar with how this code is working, and have been trying to work it out, but I'm not sure I understand the use of "idx" and how the singular "slide" term comes into play.
I'm a jQuery novice to say the least so please bear with me here.I need to swap out some images in a timed sequence. I found a tutorial online which kind of does what I need. Here is the code:
function
swapImagesMaps
(){
[code]....
I am trying to roll out a 24 hour event, where at the top of every hour one div is swapped out for another. The code I'm using is:
onload=function(){
var rightNow = new Date();
var day = rightNow.getDay();
var hour = rightNow.getHours();
[Code].....
But, it only works with two instances of it...for two divs. If I put the code in three or more times, to swap out 3 or more divs, it doesn't work.
I'm thinking I should be able to write everything into one block of code, but can't figure it out. Any suggestions? I'm sorry to bother people with this, I just can't find any info online and I want to test it out ASAP so I know if I have to abandon the effort and try something else. I would just like to avoid having to build it in Flash too.
I would like slideUp to show some text and slideDown to hide the text. Is this possible? If so, how do I do it?
View 2 Replies View RelatedHow to disablea buttonon page load (not an actual submit button -- an image that's hyperlinked) and then enable it and swap out the image once the "next" button is clicked?
View 1 Replies View RelatedI am showing an image possibly 957x30 pixels size on a page. Whenever there is a mouseover or hover on this image, it is swapped with another image (say 957x130 pixels) by expanding its division in slidedown fashion and stays visible for few seconds before swapping back with first image.
View 1 Replies View RelatedI'm trying to do a basic image swap when a link is mouseovered. The idea is that you hover over a group of links that is associated with that image, and the image lights up. I have different sets of links and images all over the page.markup looks something like this:
<div class="container-left">
<img src="/images/logo1-off.jpg" alt="" width="75" height="75" />
<div class="text">
[code]....
I wanna ask how I can swap the first li text "Home" to "Menu" on hover and when I re-hover the li, it gets back to "Home" and this process goes on.
View 3 Replies View RelatedI'm trying to achieve an effect where background image will change once you hover over a different link, but not sure how to go about that...Here's what I got:
HTML
<ul id = "list">
<li id="home"><a href="#">HOME</li></a>
<li id="about"><a href="#">ABOUT</li>
<li><a href="#">PORTFOLIO</li>
<li><a href="#">WORK</li>
<li><a href="#">CONTACT</li>
<li><a href="#">GET A QUOTE</li>
</ul>
CSS
body {
background-image: url(Images/home.jpg);
} ul li {
list-style-type:none;
font-size:36px;
font-family:Impact, Charcoal, sans-serif;
} a:hover {
background-color:#7EB6FF;
-moz-border-radius: 15px;
border-radius: 5px;
width:40px;
} a:link {
text-decoration:none;
}
And JS should probably go something like this:
$("#about").hover(function() {
$(this).css("background-image", "url('Images/about.jpg')");
});
Though this only leads to image being show only partially (given that its li element only, I suppose).
I have a button that I want to be able to click on and for it to change to another image and also slide out a text panel and then when clicked the text panel slides back in and the button returns to its original state.
The code that i have found and adapted is below. So far I have it working to click on the button to expand but then I can only make it click on the panel to close not the actual button.
<!DOCTYPE html>
<html>
<head>
<link href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/themes/base/jquery-ui.css" rel="stylesheet" type="text/css"/>
[Code].....
I have a listing of items on the page and each one has a <div> with a description in it. There are two versions of each description, one short and one full length. I like the user to be able to swap between them by clicking the 'more' and 'close' links. The problem with what I wrote is that it applies to all the divs on the page instead of the specific one that was clicked. What can I change to correct it?
The jQuery:
$(document).ready(function() {
$('div.desc > p.desc-full').hide();
$('a.more').click(function() {
$('div.desc > p.desc-trunc').slideUp('fast');
[Code].....
I have an example of what I'm trying to do at [url]
And all the files are available in a 7-zip at[url]
Basically it only works one time when I click next, and never when I click previous.
Here's my script:
in a list, as seen below, i would like to first of all change the order only by clicking a button.e.g. li_elem2 and li_elem3 should change their order (positions), maybe even in a nice animated way later on...i tried to change it by editing the css properties, but didn't work out. so now i would be happy about any other approach i can take to swap items, or change positions of two list items....
<ul class="rounded">
<li class="li_elem1">Liste 1</li>
<li class="li_elem2">Liste 2</li>
[code]....
Currently I'm using this code:
$(document).ready(function(){
//when a link inside our thumbba div is clicked
$('#thumbb a').click(function(event){
//prevent the default behavior(going to the page)
[Code]....
to swap out content from a hidden div (swap-b) into the visible div (swap-a) - this works great, however, I have 12 of these "hidden" divs on the page, and I want each one to behave independently. Currently, when I click the swap button for one div, it activates all the others. I get that this is because all the divs have the same IDs, and that the function is telling all the divs to behave the same, however, I don't see how I'm supposed to apply this function to each div independently. I've tried using a "this" function to make it work, however that just breaks the function.
I'm trying to swap the class of an element when it's clicked on. Using jquery 1.6.1, here's what it looks like:
[Code]....
Now, for the sake of brevity�*i omitted some other stuff that is happening when they're clicked on. The problem is that the click event for .unchecked_container is firing fine and the class is changed, BUT when clicked on again�*the '.checked_container' click event is NOT firing.
I currently have several instances of a video player placed on the page by number of XML nodes. Each player has a source of one of 2 video codecs, dependent on browser as to which one will be read. The issue I am having is that on click of a thumb 1 video player and its corresponding sources is animated into view and plays. That is all fine, yet when selecting a different thumb the previous video continues to play unless I place the statement in green into my click function. This works until I add another node into my xml, and or place more video.pause without videos actually being in the xml (undefined, of coarse). I have been trying to find the syntax to replace the source with the corresponding thumb id (url, url2) and utilize only one player, but I have failed in my searches. Is it possible to swap the source upon clicking on the thumbs? $('video').player.pause(); is not recognized.
$(function() {
$('li.video-thumb').live('mouseover', function() {
$(this).animate({
zIndex:10,
[Code].....
I am creating a custom gallery that I require an image and text to swap on click of an anchored thumbnail. I have successfully managed to change the image on click however I can't seem to manage changing the text. Currently when a user clicks on the thumbnail both the image and text is swapped however when the user clicks on another anchored thumbnail (after clicking on the first) the image swaps correctly but the text does not change My Code
HTML
<body>
<div id="container">
[code]....
What is a good way to switch a number at the end of a string?Im trying to change the value 0 to value 1 at the end of a URL when a button is clicked. (And vise-versa)So if I have this:<a class="important_ajax" href="projects/important_ajax/0"></a>Them the part here should be simple but im unsure of a good way to do this easily:
$(".important_ajax").click(function() {
$obj = $(this); // So I can use THIS object inside of other objects.
$url = $obj.attr('href'); // This is the URL: projects/important_ajax/0
[code]....