JQuery :: Switch Image Source During Toggle?

Oct 2, 2009

I have some divs I am toggling and there is a little + sign image I want to change to a - sign image when the toggle event occurs, but can't quite figure it out. Here is the toggle code I have (taken from

[Code]...

View 5 Replies


ADVERTISEMENT

JQuery :: Toggle The Source Of An Image?

Nov 19, 2010

I recently discovered the awesomeness of jQuery, and decided to use it.I'm currently using the slideToggle() to toggle my div nicely.The thing is, I also want to have a small icon to change according to wether the div is visible or not.Here's my HTML:

HTML Code:
<div class="box">
<!-- Content of this box will come later -->

[code]....

View 1 Replies View Related

JQuery :: Toggle/Switch For Multiple Items?

Dec 29, 2009

I'm looking for a lightweight way to be able to switch between 2 divs on a page.

I have found various ways to do this online with jQuery, but none of which are able to handle multiple switches and make it extendable across the pages of my website efficiently.

For example I could have 12 - 15 individual elements on a page (All with same style) each with an option to switch content e.g. "Click here to do something" then once clicked "it would reveal something" (Within that element/<li> tag) - so it's element specific.

For example:

Code:
<ul>
<li class="box>
Title

[Code]....

But of course as it's element specific you have to associate each id together but you can't have two id="2" - as that won't validate.....

Looking around, a perfect example can be seen at: [URL]

And because it's CMS driven and will have multiple categories/pages, you can't list all the id's with the javascript, so it has to be portable/OOP (Is that the word?) so just a main identifier in the JS...??

Where you click to reveal code and it switches div, but only for that element, it doesn't effect anything else.

View 2 Replies View Related

Jquery :: Toggle Be Use To Switch Divs On Page Load Instead Of Having To Click A Button To Start The Action?

Jul 20, 2010

Can JQuery toggle be use to switch divs on page load instead of having to click a button to start the action? What would I have to write in the header to make this happen if this is possible?

View 2 Replies View Related

DHTML Button Toggle Switch

Aug 18, 2005

I have searched high and low for this topic and can't find it anywhere. I have an administration form that lists tasks for an admin. For each item on the task list I want to offer the admins a button that will dynamically show a form within the page and just under the task item (without sending the page back to the server at this point). When the button is clicked I want the text on the button to change from "Click here to add comments" to "Close this form". I also want any open form to close if another 'open form button' is pressed.

I am still not that strong in JavaScript and DOM. I am not necessarily looking for some to do this for me, but I would like at least a starting point. I have found a small snippet that uses an image as the trigger for the event, but I would like to use a button to stay consistent with the look and feel of the page.

View 6 Replies View Related

Replace Image Source With Other Source

Nov 23, 2009

I have a website that I frequently visit (FWIW, Firefox 3.x is my browser of choice) with many image sources referring to URLs that end with "-thumbnail.jpg". However, for better image quality, I am trying to use Greasemonkey to replace all instances of "-thumbnail.jpg" in the source of images on this site with "-bigthumbnail.jpg". The closest I could think of was to somehow use getElementsByTagName and innerHTML.replace, but realized that innerHTML does not do HTML, only content.

Below is as far as I tried to get on my own,

var as,ae;
as = document.getElementsByTagName("img");
for (var i = 0; i < as.length; i++) {
ae = as[i];
ae.innerHTML = ae.innerHTML.replace(/-thumbnail/gi, "-bigthumbnail");
}
})();

View 2 Replies View Related

Make The Source Of A Embedded Sound Switch To Different Sound Files?

Oct 10, 2011

I am trying to use the following code to make the source of a embedded sound switch to different sound files based on which link is clicked:

javascript:
scales=Array("sounds/scales/Mscale.wma", "sounds/scales/hminscale.wma", "sounds/scales/nminscale.wma", "sounds/scales/mminscale.wma", "sounds/scales/chrscale.wma");
function Mscale() {

[Code].....

View 8 Replies View Related

JQuery :: Image Switch : Custom 'hover' Event Fails / Resolve This?

May 25, 2010

It's kind of hard to start explaining what i did or maybe even harder why i did it that way. But ok i neededtext replacement for custom fonts. Cufon couldn't be used because of the large amount of text and javascript in general on the site. It should play nice on IE6 that's why i chose to use facelift(server side text to image replacement). The problem arose when i needed to show a different font on hover state. I created two elements with the same position and now i want to switch them on hover state! It's actually working but when hovering fast over the different elements the hover state's mixes up ending ugly and wrong...

View 1 Replies View Related

JQuery :: Way To Change Image Source

Sep 6, 2010

Can I change an image source on user click?[code]...

View 2 Replies View Related

JQuery :: How To Detect Image Source

Oct 13, 2010

I need to write a hover function to detect a div's image source.If it has a 'apple.jpg' image, then change the src to 'orange.jpg'.If the div has no image, then do nothing.

<div id='CheckImg'>
<img src="apple.jpg">
</div>

View 3 Replies View Related

JQuery :: $.post As Source For Image

Aug 28, 2011

I am trying to post to a php page that generates and image and then use that img as the background for a div.

originally on the php side i was using the GET method, but I needed to feed more and more parameters into the function and POST made more sense.

my original "get" style jquery function which worked looked something like this I'll take out the stuff that doesn't really pertain to the problem

function render_image(get_img_url, area)
{
var map_image = new Image();
var map_img = map_img_url;

[Code].....

This actually works and according to firebug, the post is responding as 200 and outputting image information. It just won't apply that information to the background-image attribute of the div.

View 1 Replies View Related

JQuery :: Changing Image Source From Database?

Oct 24, 2011

What I want to do is replacing the source of an image so another image is displayed. The new source must come from a database.

HTML

<img id="image" src="" alt="">

JQuery

<script>
$(document).ready(function(){
var ID = 1;
$('image').attr('src', {src: 'image_load.php?id=' + ID} );

[Code].....

View 4 Replies View Related

JQuery :: Getting Image By Source With Special Characters?

Apr 14, 2010

I'm trying to get some images on my page by their src attribute. Src attribute have this format :

src = [URL]

For doing that I'm using the following query :

$j("img[src*='request=gettile'][src*='"+$j(this).data("target")+"']")
$j(this).data("target") contains my mapname, it works fine.

But my users can use mapname that can be contained in another map names. Example : mapblabla and pbla. When I'm searching pbla it's returning images of mapblabla and pbla. That's why I need to put the symbol equal before and the symbol & after my map name. Then the request is :

$j("img[src*='request=gettile'][src*='\="+$j(this).data("target")+"\&']")

View 1 Replies View Related

JQuery :: How To Replace Only Part Of Image Source

Oct 6, 2010

I am trying to make a generic function called whenever the window size changes. I want this function to apply to several different images. The idea is that when the window is resized the function will only change the end of the source code by replacing "_small", "_medium", "_large" with the appropriate size depending on the window. The problem is that when I use the code below it makes ALL of the images the same. The variable imageRightIdStr genereates a list of ids of all of the images that I would like this function to affect. ex: #imageRight101,#imageRight201,#imageRight202,#imageRight203,#imageRight301 etc.

Here is the code that I have now. It mostly works except it makes all of my "imageRight_" images the same.
var contentwidth = $('#background').width();
if ((contentwidth) < '1175') {
var logo= $('#pageLogo');
var rightImage = $('.rightImage');
logo.attr('src',logo.attr('src').replace('_large','_small'));
logo.attr('src',logo.attr('src').replace('_medium','_small'));
$(imageRightIdStr).attr('src',$(imageRightIdStr).attr('src').replace('_large','_small'));
$(imageRightIdStr).attr('src',$(imageRightIdStr).attr('src').replace('_medium','_small'));
}else if ((contentwidth) < '1440' && (contentwidth) > '1175') {
var logo= $('#pageLogo');
var rightImage = $('.rightImage');
logo.attr('src',logo.attr('src').replace('_large','_medium'));
logo.attr('src',logo.attr('src').replace('_small','_medium'));
$(imageRightIdStr).attr('src',$(imageRightIdStr).attr('src').replace('_large','_medium'));
$(imageRightIdStr).attr('src',$(imageRightIdStr).attr('src').replace('_small','_medium'));
}

View 3 Replies View Related

Ajax :: Set The Image Source To The Image Name Returned Back?

Feb 15, 2012

I have an ajax call that sends some data to process.php and return back the image name. In process.php I returned the name as follows:

echo "image.png";
The ajax call is:
var $chart = $( '#chart' );
var $test = $( '#test' );

[Code]....

so from test div i get the path printed right: (./images/image.png), but I don't get the image to be desplayed

View 2 Replies View Related

Getting Switch Image To Be A Link As Well?

Apr 13, 2011

I'm trying to create a switch image code that will allow the new image to be a link as well. In the list item where you'll see ('blue.jpg') if I try to make this an anchor tag - it breaks the code.

<head>
<script>
function switch1(div) {
if (document.getElementById('blue')) {

[code].....

View 6 Replies View Related

Switch Image By Variable?

Apr 12, 2011

I'm writing an image gallery script in which the thumbnail for the currently-viewed image is indicated with a smaller image below the thumbnail. My placeholder is as follows:

<img name="indicator0" alt="indicator>

with indicator1, indicator2, etc. following, one below each thumbnail. In my script, which placeholder has the indicator is called by the variable thumbIndicator. I'd like to be able to do that like this:

document.(thumbIndicator).src = "indicator_image.jpg";

but this has not worked. I've also changed my image placeholder to this:

<img id="indicator0" alt="indicator">

and the script to this:

document.getElementByID(thumbIndicator).src = "indicator_image.jpg";

View 6 Replies View Related

Image Switch Function Using Array?

Oct 9, 2011

I have the following as a code for an image rotation on each click (with three images)... when I load the page the first image loads fine and I click on it twice and the other two images switch smoothly, but then click a third time to go back to the first image and it doesn't go back to the first image. here's the javascript:

Code:

imgs=Array("pics/adv/chrebMs1.jpg","pics/adv/chrebMs2.jpg","pics/adv/chrebM.jpg");
var x=0;
function change() {

[code].....

and heres the html:

Code:

<img src="pics/adv/chrebMs1.jpg" id="chrsc" alt="" onclick="javascript:change();"/>

View 2 Replies View Related

Switch Image On Expanded Content?

Mar 12, 2011

Im creating a javascript content expander and would like to know how to create it so it changed the image from an down arrows to open the box, and a down arrow to close the box.Here is my current code.

Code:

<script type="text/javascript">
//var persistmenu="yes"
var persisttype="sitewide"

[code].....

I want the <div class="rightnews"> thing to change from an up arrow to a down arrow.Here are the icons im using.for the box to contract:

for the box to expand.

View 1 Replies View Related

JQuery :: Can't See Source (with View Source) When Loads External Html Into A Div?

Feb 23, 2011

I got some code that loads divs from other web pages into a particular div in my main page. In other words, I click on a button, and this tells jquery to load afragment of a particular page into my main page. For instance if I have 5 web pages onrock stars, I could have 5 buttons, and each button could load one rockstar's biography into a div on the main page (and replace whatever was there before). This works, and I do see the content that it loaded. But when I do 'view source' in IE, I do not see that content (the bio of the rock star). Another clue that this content is not really there, is when I try and run some code on that content. The content (from those external pages) have divs with specific names, and I try and make them into collapsible panels by running the following short function:

var IdentifyPanels = function() {
$("DIV.ContainerPanel > DIV.collapsePanelHeader > DIV.ArrowExpand").toggle(
function() {

[code]....

View 2 Replies View Related

Switch Between Two Images - Session Image Switching

Sep 27, 2011

I have a site where i switch between two images using some JavaScript. What I need is to be able to set a session variable or something so that if someone selects shading on or off it sticks to that for the rest of the session.

Any idea or even a point in the right direction. Do i need cookies or is there a simple way to do this

[url]

View 13 Replies View Related

OnLoad Image Event Style Switch

Aug 18, 2009

Been trying to get a short script I wrote to work 100%. Basically it checks to see if the main page image is =>375px and if it is shunts the text down below it. Its not a live site yet and due to it being so short I thought I would just copy and paste it here:

function checkImage(imageId) {
if(document.getElementById) {
var id = document.getElementById(imageId);

[code]....

The problem is with IE6, it randomly decides not to work without any sign from the debugger that anything is wrong. This is my first time using onLoad with an image, is there any quirks with it such as page load order (e.g. if the image finishes loading before the text loads this wouldn't appear to run?).

View 1 Replies View Related

JQuery :: Registering Toggle In An Image?

Jan 5, 2012

I'm trying to register a toggle event in an image. It works fine for the click event like this:

var img = $("<img/>", {
src: "/Content/Images/expand_icon_left.png",
style: "position:absolute;margin-left:" + marginLeft + ";margin-top:10px;",
click: function() { alert("do toggle"); }
});

I want to do the sabe as shown above, but with toggle event instead of click event.That's wahat I've been trying:

[Code]...

View 2 Replies View Related

JQuery :: Toggle Image Size On Click

Aug 19, 2011

with this line $('#'+linkID).load('img.php?verzeichnis='+title); images are loaded onlick into a div via the img.php. after this the image tags look like this:

[Code]...

the class small sets the height to 150px. what i want now is to change the image height onclick to 400px. If the image is clicked again, it should be resized back to 150px height. i greated a style called .big with 400px and thought i can toggle the style between big an small. But unfortunately nothing happens it seems the image selector is ignored. maybe somone can help me addressing the images onclick. [URL]

View 2 Replies View Related

JQuery :: Multiple Source Without One Source Stop The Other

Aug 30, 2010

i don't know so much about jquery so just i use them with indication from their web site. so my problem is how can i use multiple source of jquery without one source stop the other,and that what i need:

[Code]....

View 2 Replies View Related

JQuery :: Using Compound Css Selectors To Toggle A Class Of An Image?

Mar 12, 2011

I'm creating a hover effect like this. I have a 6 columns of images. There are 2 images per column stacked on top of each other. Like so:

X X X X X X
X X X X X X

The top row of X's I want to start out as invisible. When you hover over the bottom row of images, the top row fade's in (by toggling the css code opacity from 0 to 100), and then when you mouseover, it fades back out to 0. I'm having trouble setting this up. Here's my HTML:

<div class="carbox" id="box1"><img src="img/impreza2.jpg" class="imgtophidden"/><img src="img/impreza.jpg" class="imgbot" /></div>
<div class="carbox" id="box2"><img src="img/wrx.jpg" class="imgtophidden"/><img src="img/wrx.jpg" class="imgbot" /></div>
<div class="carbox" id="box3"><img src="img/legacy2.jpg" class="imgtophidden"/><img src="img/legacy.jpg" class="imgbot" /></div>

[code]....

View 1 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved