JavaScript - Stop Hiding Text On Hover
Hi
Im playing around with some JQuery and have a small problem with my menu. I want the text to always be visible, be on hover and not on hover. Currently, the text is only visible when I hover the <li> item. Check it out at http://cooper.zxq.net Below is my code using to produce the menu. Code: <html> <head> <script src="jquery-1.3.1.min.js" type="text/javascript" ></script> <script src="jquery.easing.js" type="text/javascript"></script> <script type="text/javascript"> $(document).ready(function(){ $('li.image').css({opacity: 0}); $('li.image').hover(function(){ $(this).animate({opacity: 1},400); }, function(){ $(this).animate({opacity: 0},400); }); }); </script> <style> .ddsmoothmenu{ background-color:Gray; width: 100%; height:27px; margin:0 auto; padding:0; } .ddsmoothmenu ul{z-index:1; margin: 0; padding: 0; list-style-type: none;} .ddsmoothmenu ul li{position: relative; float: left; } .ddsmoothmenu a{display:block; color: white; border-right: 0px solid #778; color: #2d2b2b; text-decoration: none; font: 11px Verdana; font-weight:bold;} .ddsmoothmenu ul li a:link, .ddsmoothmenu ul li a:visited{color: yellow; z-index:50; line-height:27px;} .image { line-height:27px; height:27px; background:url(images/button.gif) no-repeat right top; padding-right:30px; display:inline-block; } .image ins { background:url(images/button.gif) no-repeat left top; height:27px; line-height:27px; display:inline-block; padding-left:30px; } image:hover {background-position:right -155px;} image:hover ins {background-position:left -155px;} </style> </head> <div id="smoothmenu1" class="ddsmoothmenu "> <ul> <li class="image"><a href="#"><ins>Home</ins></a></li> <li class="image"><a href="#"><ins>Products</ins></a></li> <li class="image"><a href="#"><ins>Services</ins></a></li> <li class="image"><a href="#"><ins>Contact Us</ins></a></li> </ul> </div> </html> Hope anyone can provide some help Thanks! Similar TutorialsI have a simple password protection setup on my site but the password is displayed when it is typed in is there a way to change it to a # or * when it is typed in
I was using the below code to fade text links in and out on hover. But the problem I'm having is that if you hover over the text a few times quickly the animation will play over and over. Can someone help me add a 'callback'(?) so while the animation is still playing it won't fade in/out again until its finished? Or point me in the direction of a better way of doing this effect. Thanks for reading and I looking forward to your help and responses! Heres the code: Code: $(document).ready(function(){ $(".thumbs img").fadeTo("slow", 0.6); // This sets the opacity of the thumbs to fade down to 60% when the page loads $(".thumbs img").hover(function(){ $(this).fadeTo("slow", 1.0); // This should set the opacity to 100% on hover },function(){ $(this).fadeTo("slow", 0.6); // This should set the opacity back to 60% on mouseout }); }); http://bowser.effectgames.com/~jhuck.../multiple.html is there a way to add a tipbox when the mouse hover on the copied text by jquery.the tip box say"the text has been copied" thank you. Hello, I was wondering if anyone could help me with a personal website I am modifying for a friend. He basically has a list of links such as: Home Blog Pictures Links What I want to do is that whenever you roll over, say, "Blog", an image appears to the right of the links (the image will be a small screenshot of what the blog looks like). When you roll over "Pictures", a different image appears in it's place. I already know how to do this when rolling over images, but not rolling over text. I used document.getElementById and just set the src to the image, but how do I do this when I just have text to roll over? Is it possible/recommended to use the follow JQuery? http://ajax.googleapis.com/ajax/libs.../jquery.min.js Thank you for your time Right i need some help with some code, i have been trying 2 days to get it to work! basically the 3 image locations are in Variables in PHP $piclocation1 $piclocation2 $piclocation3 What i want is when you hover over the div class "breaking-news", i want the div ID "latest-news-image" to change to that specific image background. example the top "breaking-news" class is on hover and the image $piclocation1 should show in "latest-news-image". if the middle "breaking-news" class is on hover the image $piclocation2 should show in "latest-news-image". and so on if you could help me figure out a way around to get this to work i would be ever so greatfull, as i dont know if i got this in the right area as it would contain javascript, php and poss Css! and even if you could point me in the right direction would be helpful! this is the website page i am testing it on if you would like to look at if visually http://www.wolverhampton-wanderers.co.uk/text.php and here is the code: Code: <html xmlns="http://www.w3.org/1999/xhtml"> <head> <link rel="Stylesheet" type="text/css" href="./wolves.css"/> <title>Untitled Document</title> <?php $getnews = "SELECT * FROM `news` ORDER BY `news`.`id` DESC LIMIT 3"; $news = mysql_query($getnews) or die(mysql_error()); $counter = 1; while($row1 = mysql_fetch_array($news)){ if($counter == 1) { $picture1 = $row1['imageID']; $getimage1 = "SELECT * FROM news_images WHERE imageID = $picture1"; $image1 = mysql_query($getimage1) or die(mysql_error()); $pic1 = mysql_fetch_array($image1); $piclocation1 = $pic1['imageFile']; } if($counter == 2) { $picture2 = $row1['imageID']; $getimage2 = "SELECT * FROM news_images WHERE imageID = $picture2"; $image2 = mysql_query($getimage2) or die(mysql_error()); $pic2 = mysql_fetch_array($image2); $piclocation2 = $pic2['imageFile']; } if($counter == 3) { $picture3 = $row1['imageID']; $getimage3 = "SELECT * FROM news_images WHERE imageID = $picture3"; $image3 = mysql_query($getimage3) or die(mysql_error()); $pic3 = mysql_fetch_array($image3); $piclocation3 = $pic3['imageFile']; } $counter = $counter + 1; } ?> </head> <body> <div class="shaddow"><!-- This is the shaddow behind the content --> <div class="content"> <!-- This is the content and main background --> <div class="header"><img src="../images/header.jpg"/></div> <div class="menu"> <div id="nav"> <?php $cat = "SELECT * FROM `top-menu` ORDER BY 'category' ASC"; $category = mysql_query($cat) or die(mysql_error()); $start = 1; while($row = mysql_fetch_array($category)){ $submenu = $row['sub-menu']; if($submenu == '1'){ echo "</li><li><a id='{$row['Active-ID']}' " . "href='{$row['Address']}'>" . "{$row['Text']}</a>"; } elseif($submenu == '2'){ if($start == 1){ echo "<ul>"; } echo "<li><a id='{$row['Active-ID']}' " . "href='{$row['Address']}'>" . "{$row['Text']}</a></li>"; $start = $start + 1; if($submenu !='2'){ echo "</ul></li>"; $start = 1; } } } echo "</ul></li><a class='nav-end'></a>"; ?> </div> </div> <div id="latest-news"> <?php $getnews = "SELECT * FROM `news` ORDER BY `news`.`id` DESC LIMIT 3"; $news = mysql_query($getnews) or die(mysql_error()); $counter = 0; echo "<div id='latest-news-image'></div>" . "<div id='latest-news-header'>Breaking News</div>"; while($row1 = mysql_fetch_array($news)){ echo "<div class='breaking-news'><div class='breaking-news-header'><a href='#'>{$row1['title']}</a></div>" . "<div class='breaking-news-info'>Posted on {$row1['date']}, by {$row1['author']}</div>" . "<div class='breaking-news-desc'>{$row1['desc']}</div>" . "<div class='breaking-news-readmore'><a href='#'>Read More</a></div></div>"; $counter = $counter + 1; } ?> </div> </div> </div> </body> </html> Hello all. I'm sure this is really easy, but I have a question about being able to change a main image depending on a mouseover of particular text. I have a website where I am hosting a recipe, and I want to be able to show a 'main' picture that changes depending on where the user is hovering in the instructions. It would be very similar to this: http://piscesmike.com/Pages/recipes/onions.html The exception being that the top images are replaced by line by line instructions, and the main image changes depending on which instruction you are hovering on. Alternatively, I could also use a pop-up window with the image for the particular instruction, but could not get that to work either. I coded everything for the above link, but just cant seem to get this working. Any help is greatly appreciated. And, also feel free to try out the recipe's from PiscesMike.com, or to poke around. I know there are a few other errors (one being the day of the week deal) so once again, any input or help would be a tremendous help. Thanks and sorry for being such a noob! trying to find a example of when you hover over a image, text appears on the bottom so it could be a picture of a dog, whne you put your mouse over it, text will show in the picture (ie* transparent background for text so it's readable) anywhre where I can find a example of this???? I've been looking around for some time now and can't seem to find anything for what I'd like. I want it to be that when you hover over a segment of text, a box will appear with what in hopes will be more text. And then that box move away if you move your cursor.
Hello, I am trying to do an image swap when hovering over "TEXT" links. For instance, I would like to first have a "mainpic" in a div that would be replaced by either image 1,2 or 3 (depending on if you are hovering over"text link 1,2 or 3). I would use normal rollover "image" swaps, but would prefer to have the "trigger" to be "text" (for SEO reasons). I am just getting familiar with javascript, but do not even know where to begin! I have read multiple forum entries throught google, but could not find any where I could have "multiple" text links. I would so much appreciate it if anyone could please point me in a direction. Sincerely, Buffmin Hello All, I am new to this forum and to web development, I am trying to hide div based on conditions.. This is the scenario: the div should never appear again for that user, until i write another server side message. lets say i write a message today saying " we are really sorry, but the website will be don for one hour today" and you login today, the message will be displayed, when you click close its closed, it wont appear again for you, until i post another message, but each message would have an expiration date, if i post a message which would be displayed to every user, i should decide how long i want it displayed, maybe 24 hrs, so in 24 hrs the message should no longer display. Please help me out on this...I need a solution fast... Thanks Hi, If I want to hide a title / heading if a field below is not filled in, what would be the js for that? I have an "Attachments" h2 heading and three following fields for the client to add up to three attachments. But if none are filled in I want the h2 heading to not display. This is what I have so far: var attachment1 ='{tag_attachment 1}' var attachment2 ='{tag_attachment 2}' var attachment3 ='{tag_attachment 3}' === if(attachment1 == '') { document.getElementById('attachment1').style.display = 'none'; } if(attachment2 == '') { document.getElementById('attachment2').style.display = 'none'; } if(attachment3 == '') { document.getElementById('attachment3').style.display = 'none'; } === <div id="attachments"> <h2>Attachments</h2> <p>{tag_attachment 1}<br /> {tag_attachment 2}<br /> {tag_attachment 3}</p> </div> This should take care of the three fields, but how do I tie in the heading too? Thank you! Hi, I wondering if anyone can help: I've got rows of divs in this manner <div class="row">This is row 1 <a href="click">click here to show more</a></div> <div class="hidden row"><p> hidden text for row 1</p></div> <div class="row">This is row 2 <a href="click">click here to show more</a></div> <div class="hidden row"><p> hidden text for row 2</p></div> <div class="row">This is row 3 <a href="click">click here to show more</a></div> <div class="hidden row"><p> hidden text for row 3</p></div> <div class="row">This is row 4 <a href="click">click here to show more</a></div> <div class="hidden row"><p> hidden text for row 4</p></div> I wish to have some javascript to toggle the hidden row for its corresponding link. Please can someone help point me to an example if available. Any help will be greatly appreciated OK, I've been working on this for quite some time now, and have it working, almost. lol. Hopefully someone here can lend a fresh pair of eyes to what I'm doing wrong (bare in mind, I don't know javascript very well at all). I'm creating a simple faq page for my site, but there's a lot of questions, so instead of lumping it all in at once, I'm using divs to store answers in that hide and reappear as my guests click on a question they want to see an answer too. ok, heres the basics of the code I'm using so far: Code: <script type="text/javascript"> function showit(boxName) { theBox = document.getElementById(boxName); theBox.className = "boxVisible"; } </script> <script type="text/javascript"> function hideit(boxName) { theBox = document.getElementById(boxName); theBox.className = "boxHidden"; } </script> That, is in the head section of my page. Then for the links and such I have: Code: <div><a href="link.html" onclick="showit('s11'); hideit('s12'); hideit('s13'); hideit('s14'); hideit('s15'); hideit('s16'); return false;">Do you shoot in color, or black and white?</a></div> <div id="s11"> We shoot in color. Color prints can be printed in black and white and come out perfectly just as though they were shot in black and white. However if you shoot in black and white, you can't print it in color. For this reason we shoot all of our images in full color. </div> obviously there are more questions that that, but I don't want to fill this screen with all of them either. Ok, heres what its doing, when you click on the first question, no problem, the answer opens right up, appears where it should be, everythings great, except, that its also following the link and leaving the page. I get to a 404 error telling me that link.html does not exist on my server. So, apparently the Code: return false isnt working.... what do I need to do here, I'm now lost... OH, I should include the CSS I'm using for these DIV's so you can see what the javascript is calling on for them: Code: .boxVisible { display: block; position:relative; left:25px; width:755px; overflow:auto; } .boxHidden { display: none; } Thanks to ANYONE that can help out! I don't mean for this to be an advertisement, and if its not allowed by all means I'll remove it from this post, but if you want to see my exact code that I'm using, you'll find the page I'm working on at http://www.smmahoney.com/index.php?page=faq Hi all, I have some javascript that when a link is clicked hides the div and when it is clicked again shows the div... what I want to do is reverse that, so it is intially hidden. I have tried changing the display none to different parts but it always shows on load: Code: function toggleDiv (divid) { if (document.getElementById (divid).style.display == 'none') { document.getElementById (divid).style.display = 'block'; } else { document.getElementById (divid).style.display = 'none'; } } Code: <a href="javascript:;" class="showmorelink" onmousedown="toggleDiv('checks');">Safeguarding</a> Can anyone advise? Many thanks, Greens85 hello all...just joined up...very anxious to get my website improved with some of your kind help i have this current JS running, but Im having some little issues i thought someone here could help me out with. I want the background color to be #0f3559. But whenever I add this to the script it disables the buttons I have included. Also, I would like to have just one "Show/Hide" button that does both functions rather than 2 seperate. can anyone take a look? THANKS. <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd" > <html lang='en'> <head> <meta http-equiv='Content-type' content='text/html;charset=UTF-8'> <title>ESPN SCORELINE</title> <script type="text/javascript"> function setVisibility(theId, visibility) { document.getElementById( theId ).style.visibility = visibility; } function setDisplay(theId, display) { document.getElementById( theId ).style.display = display; } </script> </head> <body> <input type="button" value="show" onclick="setVisibility('scoreline', 'visible'); "> <input type="button" value="hide" onclick="setVisibility('scoreline', 'hidden'); "> </body> <iframe src="http://espn.go.com/bottomline/espnewsbottomlinebasic.html" width="1000" height="45" frameborder="0" marginheight="0" marginwidth="0" scrolling="no" style="visibility:hidden;" alt="scoreline" id="scoreline"></iframe> </html> Hi, I got a table with hundreds of rows...and I want the user to be able to hide a single one by clicking on the table row. How can I do this without typing in hundreds of ids like 1,2,3,4,5... Since you can't get elements by class and ids have to unique I'm not sure how to do this. Also the order of the rows will change when they get updated so it would end up being a mess of unordered ids. Thanks. I have this simple checkbox menu http://myresearchfinder.com/dev/checktest.html If you check the cancer box a div will appear. If you check lung, another menu pops up. If you check colon nothing appears because it's behind the lung div. I am aware of z-index. But because a person may go back and forth between menus I need a way to make sure the appropriate div is always on top. Any ideas? Hi, Would someone here please help me with this script. I know I am a complete hack at this, but I need to get it to work. Your help is appreciated. As you can see, based on the if statement, I need to leave the Div element below hidden, or un-hide it. I know the first part works. The second part (after "else" ) is where I am having the problem. Code: <td> <script type="text/javascript"> if ([fieldXX]==1) { document.write("<a href='page1.asp?itemid=1234'><img src='images/btn-choose.gif' border='0' alt='choose button'</a>"); } else { var id = 'hide-buy-btn'; var item = document.getElementById(id); if (item) { item.className=(item.className=='hidden')?'unhidden':'hidden'; } } </script> <div id="hide-buy-btn" class="hidden"> x xother button code x </div> </td> Hi guys, I am working with a plugin calld Hashslider which is a fairly simple div slider. Here is the code for startrs Code: // hashslider v0.9 by manuel huegel, copyright 2010 // mgoys.com $(document).ready(function(){ //get width and height of the wrapper and give it to the UL var wrapperwidth = $('#slider').width() * $('#slider ul > li').size(); $('#slider ul').css('width', wrapperwidth); var wrapperheight = $('#slider').height(); $('#slider ul').css('height', wrapperheight); //set my li width var width = $('#slider').width(); $('#slider ul li').css('width', width); //set my counter vars var counter = $('#slider ul > li').size(); var decount = 1; var autocount = 1; //create my number navigation var createNum = 1; $('#numbers li:first-child').html(createNum).addClass('activenum').attr('id', 'id1'); while ( createNum != counter) { $('#numbers li:last-child').after('<li> </li>'); createNum++; $('#numbers li:last-child').html(createNum); $('#numbers li:last-child').attr('id', 'id' + createNum); } //get my number-width (number navigation should always be centered) var numwidth = $('#numbers li:first-child').width() * $('#numbers li').size(); $('#numbers').css('width', numwidth); //slide the button to the next item function goNext() { if ( decount != counter) { $('#slider ul').animate({ left: '-=' + $('#slider').width() }, 400, 'swing', function() { }); $('.activenum').removeClass('activenum').next().addClass('activenum'); decount++; window.location.hash = decount; } } function goBack() { if ( decount != 1) { $('#slider ul').animate({ left: '+=' + $('#slider').width() }, 400, 'swing', function() { }); $('.activenum').removeClass('activenum').prev().addClass('activenum'); decount--; window.location.hash = decount; } } //make the number clickable $("#numbers li").click(function() { //$('#info4').html( $(this).html() ); var clickednum = $(this).html() * - $('#slider').width() + $('#slider').width(); //$('#info4').html( clickednum ); $('#slider ul').animate({ left: clickednum }, 400, 'swing', function() { }); $('.activenum').removeClass('activenum'); $(this).addClass('activenum'); decount = $(this).html(); window.location.hash = $(this).html(); }); //thaths the hash-shizzle if ( window.location.hash != '') { //get hash, scroll to position var hashnum = window.location.hash.substr(1) * - $('#slider').width() + $('#slider').width(); $('#slider ul').animate({ left: hashnum }, 0, function() { }); //set counters to position decount = window.location.hash.substr(1); $('.activenum').removeClass('activenum'); var hashname = window.location.hash.substr(1); $('#id' + hashname).addClass('activenum'); } //get my clickers $("#right").click(function() { goNext(); }); $("#left").click(function() { goBack(); }); //get mousewheel function $("#slider ul").mousewheel(function(event, delta) { if (delta > 0) { goBack(); event.stopPropagation();event.preventDefault(); } }); $("#slider ul").mousewheel(function(event, delta) { if (delta < 0) { goNext(); event.stopPropagation();event.preventDefault(); } }); }); As you will see the current code loops through all of the slides, and when it reaches the last (or first) the previous and next links become unclickable. I would like to go a stage further than this and make them dissapear entirely. I don't know how to do this or even to start, I dont even know what function to edit. Please help guys. Thanks in advance Dan This might not be as simple as the title suggests. It may be a CSS problem, please say so if you know it to be and I will move it to the correct forum. Now for the question, Please visit: http://danielrhyshardy.com/header/demo.html I am using the jquery plugin supersized to create a carousel of images in the background of the page. As you will see though, as the transition starts, the second image is visible. I only want it to be visible when it indeed starts to overlap the current image. (i.e when the bench image overlaps the trees etc) Here is the CSS: Code: * { margin:0; padding:0; } body { background:#111; height:100%; } img{ border:none; } #supersized { position:absolute; left:0; top:0; overflow:hidden; z-index:-999; height:50%; width:100%; } #supersized img{ width:auto; height:auto; position:relative; display:none; outline:none; border:none; } #supersized.speed img { -ms-interpolation-mode:nearest-neighbor; image-rendering: -moz-crisp-edges; } /*Speed*/ #supersized.quality img { -ms-interpolation-mode:bicubic; image-rendering: optimizeQuality; } /*Quality*/ #supersized a { z-index:-30; position:fixed; overflow:hidden; top:0; left:0; width:100%; height:50%; background:#111; display:block; } #supersized a.prevslide { z-index:-20; } #supersized a.activeslide { z-index:-10; } #supersized a.image-loading { background:#111 url(../img/progress.gif) no-repeat center center; width:100%; height:50%; } #supersized a.prevslide img, #supersized a.activeslide img{ display:inline; } Thanks guys Dan |