The Web Design Group

... Making the Web accessible to all.

Welcome Guest ( Log In | Register )

> OnClick Background Image
Kiana Marie
post Jun 26 2012, 04:00 PM
Post #1





Group: Members
Posts: 1
Joined: 26-June 12
Member No.: 17,338



I've had a lot of trouble with this all day, because I am so new to HTML in general that there's a lot of basics that I don't know.
I went on another site and asked for this kind of coding, and I was given this,

"if you want to use jquery is: (first you have to put id into your link as id="link")

<script type="text/javascript"
src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>

<script type="text/javascript">
$(document).ready(function(){
$('#link').click(function(){
$('#id_background').attr('src','23lz49h.jpg');
});
});

</script>"



the conversation is all on here. http://stackoverflow.com/questions/1121432...d-image-onclick

And I'm just generally confused. All I want to do is edit this page, (www.eiramanaik.tumblr.com) so that there is a button at the top, and when you click it, the current background image, (http://i46.tinypic.com/eukfg7.jpg) is changed to, (http://i50.tinypic.com/23lz49h.jpg)


Please help! sad.gif
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
 
Reply to this topicStart new topic
Replies(1 - 1)
Frederiek
post Jun 27 2012, 07:56 AM
Post #2


Programming Fanatic
********

Group: Members
Posts: 5,146
Joined: 23-August 06
From: Europe
Member No.: 9



You need to change the CSS and jQuery has a hook for that. Have a look here: http://www.jquery4u.com/dynamic-css-2/change-css-jquery/
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



- Lo-Fi Version Time is now: 28th March 2024 - 10:08 AM