Search Results

Search found 178 results on 8 pages for 'mouseout'.

Page 7/8 | < Previous Page | 3 4 5 6 7 8  | Next Page >

  • jQuery .live() not working.

    - by Silvio Iannone
    Hi there, my actual problem is that .live() jQuery method is not working. This si the code where i use it: jQuery.fn.sb_animateMenuItem = function() { var mousehoverColor = '#0089F7'; var duration = 250; return this.each(function() { var originalColor = $(this).css('background-color'); $(this).live('mouseover', function() { this.style.cursor = 'pointer'; $(this).animate().stop(); $(this).animate( { backgroundColor: mousehoverColor }, duration); }); $(this).live('mouseout', function() { this.style.cursor = 'default'; $(this).animate( { backgroundColor: originalColor }, duration); }); }); }; This snipped is used i another page in this way: <script type="text/javascript" src="ui/js/jquery-1.4.2.js"></script> <script type="text/javascript" src="ui/js/jquery-ui-1.8.1.custom.min.js"></script> <script type="text/javascript" src="ui/js/color.js"></script> <script type="text/javascript" src="engine/js/tiny_mce/tiny_mce.js"></script> <script type="text/javascript" src="ui/js/ui.js"></script> <script type="text/javascript"> // UI effects $(document).ready(function() { $('button').sb_animateButton(); $('input').sb_animateInput(); $('.top_menu_item').sb_animateMenuItem(); $('.top_menu_item_right').sb_animateMenuItem(); $('.left_menu_item').sb_animateMenuItem(); }); </script> Since my site uses AJAX requests i used the .live method in the first snippet, but when i load the page the effects are not applied the the button/input... tags. If i remove the .live method and use the 'normal' way, ui effects defined in the first snipped are applied but only the the elements loaded before any AJAX request. The elements loaded after the ajax request are not affected by first snippet (though they have the same selector). Thanks for helping.

    Read the article

  • jquery mouseover animation jumping

    - by Sylph
    Hi all, I have a table which is looped in <li>. On mouseover each row, there will be a border shown, and the row id="resFunc" will be displayed. However, in IE, the animation jumps up and down. Anyone has similar experience or solution to solve this? Thanks in advance! <div id="resDetails" align="left"> <table width="400px" class="resBox"> <tr> <td><b>{creator}</b></td> </tr> <tr> <td colspan="2"><div class="edit{_id}" id="{_id}"> {title}</div></td> </tr> <tr style="display:none" class="url{_id}"> <td colspan="2" class="edit_url{_id}" id="{_id}">{url}</td> </tr> <tr> <td colspan="2" class="edit_area{_id}" id="{_id}">{description}</td> </tr> <tr id="resFunc{_id}" style="display:none"> <td colspan="2" align="right"><b><a href="#" id="{_id}" class="editRes">Edit</a>&nbsp;&nbsp; <a href="#" class="deleteResource" id="{_id}">Delete</a></b> </td> </tr> </table><br> </div> This is the onClick function :- $(".resBox").mouseover(function(){ var id = $(this).attr("id"); $(this).addClass('highlight'); $('#resFunc'+id).show(); }); $(".resBox").mouseout(function(){ var id = $(this).attr("id"); $(this).removeClass('highlight'); $('#resFunc'+id).hide(); });

    Read the article

  • Google maps api v3: geocoding multiple addresses and infowindow

    - by user2536786
    I am trying to get infowindow for multiple addresses. Its creating markers but when I click on markers, infowindow is not popping up. Please help and see what could be wrong in this code. Rest all info is fine only issue is with infowindow not coming up. <!DOCTYPE html> <html> <head> <meta http-equiv="content-type" content="text/html; charset=UTF-8" /> <title>Google Maps Multiple Markers</title> <script src="http://maps.google.com/maps/api/js?sensor=false" type="text/javascript"></script> </head> <body> <div id="map" style="height: 800px;"></div> <script type="text/javascript"> var locations = [ ['Bondi Beach', '850 Bay st 04 Toronto, Ont'], ['Coogee Beach', '932 Bay Street, Toronto, ON M5S 1B1'], ['Cronulla Beach', '61 Town Centre Court, Toronto, ON M1P'], ['Manly Beach', '832 Bay Street, Toronto, ON M5S 1B1'], ['Maroubra Beach', '606 New Toronto Street, Toronto, ON M8V 2E8'] ]; var map = new google.maps.Map(document.getElementById('map'), { zoom: 10, center: new google.maps.LatLng(43.253205,-80.480347), mapTypeId: google.maps.MapTypeId.ROADMAP }); var infowindow = new google.maps.InfoWindow(); var geocoder = new google.maps.Geocoder(); var marker, i; for (i = 0; i < locations.length; i++) { geocoder.geocode( { 'address': locations[i][1]}, function(results, status) { //alert(status); if (status == google.maps.GeocoderStatus.OK) { //alert(results[0].geometry.location); map.setCenter(results[0].geometry.location); marker = new google.maps.Marker({ position: results[0].geometry.location, map: map }); google.maps.event.addListener(marker, 'mouseover', function() { infowindow.open(marker, map);}); google.maps.event.addListener(marker, 'mouseout', function() { infowindow.close();}); } else { alert("some problem in geocode" + status); } }); } </script> </body> </html>

    Read the article

  • Highlight Row in GridView with Colored Columns

    - by Vincent Maverick Durano
    I wrote a blog post a while back before here that demonstrate how to highlight a GridView row on mouseover and as you can see its very easy to highlight rows in GridView. One of my colleague uses the same technique for implemeting gridview row highlighting but the problem is that if a Column has background color on it that cell will not be highlighted anymore. To make it more clear then let's build up a sample application. ASPX:   1: <asp:GridView runat="server" id="GridView1" onrowcreated="GridView1_RowCreated" 2: onrowdatabound="GridView1_RowDataBound"> 3: </asp:GridView>   CODE BEHIND:   1: private DataTable FillData() { 2:   3: DataTable dt = new DataTable(); 4: DataRow dr = null; 5:   6: //Create DataTable columns 7: dt.Columns.Add(new DataColumn("RowNumber", typeof(string))); 8: dt.Columns.Add(new DataColumn("Col1", typeof(string))); 9: dt.Columns.Add(new DataColumn("Col2", typeof(string))); 10: dt.Columns.Add(new DataColumn("Col3", typeof(string))); 11:   12: //Create Row for each columns 13: dr = dt.NewRow(); 14: dr["RowNumber"] = 1; 15: dr["Col1"] = "A"; 16: dr["Col2"] = "B"; 17: dr["Col3"] = "C"; 18: dt.Rows.Add(dr); 19:   20: dr = dt.NewRow(); 21: dr["RowNumber"] = 2; 22: dr["Col1"] = "AA"; 23: dr["Col2"] = "BB"; 24: dr["Col3"] = "CC"; 25: dt.Rows.Add(dr); 26:   27: dr = dt.NewRow(); 28: dr["RowNumber"] = 3; 29: dr["Col1"] = "A"; 30: dr["Col2"] = "B"; 31: dr["Col3"] = "CC"; 32: dt.Rows.Add(dr); 33:   34: dr = dt.NewRow(); 35: dr["RowNumber"] = 4; 36: dr["Col1"] = "A"; 37: dr["Col2"] = "B"; 38: dr["Col3"] = "CC"; 39: dt.Rows.Add(dr); 40:   41: dr = dt.NewRow(); 42: dr["RowNumber"] = 5; 43: dr["Col1"] = "A"; 44: dr["Col2"] = "B"; 45: dr["Col3"] = "CC"; 46: dt.Rows.Add(dr); 47:   48: return dt; 49: } 50:   51: protected void Page_Load(object sender, EventArgs e) { 52: if (!IsPostBack) { 53: GridView1.DataSource = FillData(); 54: GridView1.DataBind(); 55: } 56: }   As you can see there's nothing fancy in the code above. It just contain a method that fills a DataTable with a dummy data on it. Now here's the code for row highlighting:   1: protected void GridView1_RowCreated(object sender, GridViewRowEventArgs e) { 2: //Set Background Color for Columns 1 and 3 3: e.Row.Cells[1].BackColor = System.Drawing.Color.Beige; 4: e.Row.Cells[3].BackColor = System.Drawing.Color.Red; 5:   6: //Attach onmouseover and onmouseout for row highlighting 7: e.Row.Attributes.Add("onmouseover", "this.style.backgroundColor='Blue'"); 8: e.Row.Attributes.Add("onmouseout", "this.style.backgroundColor=''"); 9: }   Running the code above will show something like this in the browser: On initial load: On mouseover of GridView row:   Noticed that Col1 and Col3 are not highlighted. Why? the reason is that Col1 and Col3 cells has background color set on it and we only highlight the rows (TR) and not the columns (TD) that's why on mouseover only the rows will be highlighted. To fix the issue we will create a javascript method that would remove the background color of the columns when highlighting a row and on mouseout set back the original color that is set on Col1 and Col3. Here are the codes below: JavaScript   1: <script type="text/javascript"> 2: function HighLightRow(rowIndex, colIndex,colIndex2, flag) { 3: var gv = document.getElementById("<%= GridView1.ClientID %>"); 4: var selRow = gv.rows[rowIndex]; 5: if (rowIndex > 0) { 6: if (flag == "sel") { 7: gv.rows[rowIndex].style.backgroundColor = 'Blue'; 8: gv.rows[rowIndex].style.color = "White"; 9: gv.rows[rowIndex].cells[colIndex].style.backgroundColor = ''; 10: gv.rows[rowIndex].cells[colIndex2].style.backgroundColor = ''; 11: } 12: else { 13: gv.rows[rowIndex].style.backgroundColor = ''; 14: gv.rows[rowIndex].style.color = "Black"; 15: gv.rows[rowIndex].cells[colIndex].style.backgroundColor = 'Beige'; 16: gv.rows[rowIndex].cells[colIndex2].style.backgroundColor = 'Red'; 17: } 18: } 19: } 20: </script>   The HighLightRow method is a javascript function that accepts four (4) parameters which are the rowIndex,colIndex,colIndex2 and the flag. The rowIndex is the current row index of the selected row in GridView. The colIndex is the index of Col1 and colIndex2 is the index of col3. We are passing these index because these columns has background color on it and we need to toggle its backgroundcolor when highlighting the row in GridView. Finally the flag is something that would determine if its selected or not. Now here's the code for calling the JavaScript function above.     1: protected void GridView1_RowCreated(object sender, GridViewRowEventArgs e) { 2:   3: //Set Background Color for Columns 1 and 3 4: e.Row.Cells[1].BackColor = System.Drawing.Color.Beige; 5: e.Row.Cells[3].BackColor = System.Drawing.Color.Red; 6:   7: //Attach onmouseover and onmouseout for row highlighting 8: //and call the HighLightRow method with the required parameters 9: int index = e.Row.RowIndex + 1; 10: e.Row.Attributes.Add("onmouseover", "HighLightRow(" + index + "," + 1 + "," + 3 + ",'sel')"); 11: e.Row.Attributes.Add("onmouseout", "HighLightRow(" + index + "," + 1 + "," + 3 + ",'dsel')"); 12: 13: }   Running the code above will display something like this: On initial load:   On mouseover of GridView row:   That's it! I hope someone find this post useful!

    Read the article

  • How to make sliding button sidebar in Flex

    - by Tam
    Hi, I'm fairly new to Flex. I want to make a button (icon) on the far right in the middle of the page that display a sliding side bar with multiple buttons in it when you hover over it. I want when the user hover out of the button bar it slides back again. Conceptually I got the basics of that to work. The issue I'm having is that when the user moves the mouse between the buttons in the sidebar it kicks in changing state and side bar slides back again. I tried using different types of containers and I got the same results. Any Advice? Thanks, Tam Here is the code: <?xml version="1.0" encoding="utf-8"?> <s:VGroup xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:s="library://ns.adobe.com/flex/spark" xmlns:mx="library://ns.adobe.com/flex/halo" xmlns:vld ="com.lal.validators.*" xmlns:effect="com.lal.effects.*" width="150" horizontalAlign="right" gap="0"> <fx:Script> <![CDATA[ import com.lal.model.LalModelLocator; var _model:LalModelLocator = LalModelLocator.getInstance(); ]]> </fx:Script> <fx:Declarations> <mx:ArrayCollection id="someData"> </mx:ArrayCollection> </fx:Declarations> <s:states> <s:State name="normal" /> <s:State name="expanded" /> </s:states> <fx:Style source="/styles.css"/> <s:transitions> <s:Transition fromState="normal" toState="expanded" > <s:Sequence> <s:Wipe direction="left" duration="250" target="{buttonsGroup}" /> </s:Sequence> </s:Transition> <s:Transition fromState="expanded" toState="normal" > <s:Sequence> <s:Wipe direction="right" duration="250" target="{buttonsGroup}" /> </s:Sequence> </s:Transition> </s:transitions> <s:Button skinClass="com.lal.skins.CalendarButtonSkin" id="calendarIconButton" includeIn="normal" verticalCenter="0" mouseOver="currentState = 'expanded'"/> <s:Panel includeIn="expanded" id="buttonsGroup" mouseOut="currentState = 'normal' " width="150" height="490" > <s:layout> <s:VerticalLayout gap="0" paddingRight="0" /> </s:layout> <s:Button id="mondayButton" width="120" height="70" mouseOver="currentState = 'expanded'"/> <s:Button id="tuesdayButton" width="120" height="70" mouseOver="currentState = 'expanded'"/> <s:Button id="wednesdayButton" width="120" height="70" mouseOver="currentState = 'expanded'"/> <s:Button id="thursdayButton" width="120" height="70" mouseOver="currentState = 'expanded'"/> <s:Button id="fridayButton" width="120" height="70" mouseOver="currentState = 'expanded'"/> <s:Button id="saturdayButton" width="120" height="70" mouseOver="currentState = 'expanded'"/> <s:Button id="sundayButton" width="120" height="70" mouseOver="currentState = 'expanded'"/> </s:Panel> </s:VGroup>

    Read the article

  • Animate button on MouseOver and MouseDown

    - by haagel
    I'm making my own ControlTemplate for a standard Button in WPF. I want to change the background of my button when the user hovers over the button with the mouse, but also when the user presses the button (to yet another color). This seems like a common behavior, but I can't get it to work. My template consists of a Border with an Image inside. It is the background color (a gradient really) of the Border that I want to animate. I have triggers in my template that activates animations (storyboards). The MouseOver/Out works just fine. My problem occurs when I press the button. The Press animation runs as it should, and so does the Release animation. But after this the MouseOut will never run. The button gets stuck in the MouseOver state. What am I doing wrong? <ControlTemplate TargetType="{x:Type Button}"> <ControlTemplate.Resources> <Storyboard x:Key="MouseOverAnimation"> <ColorAnimation Storyboard.TargetName="ButtonBorderGradientStop1" Storyboard.TargetProperty="Color" To="#ffefefff" Duration="0:0:0.2" /> <ColorAnimation Storyboard.TargetName="ButtonBorderGradientStop2" Storyboard.TargetProperty="Color" To="#ffc7c7ff" Duration="0:0:0.2" /> </Storyboard> <Storyboard x:Key="MouseOutAnimation"> <ColorAnimation Storyboard.TargetName="ButtonBorderGradientStop1" Storyboard.TargetProperty="Color" To="#ffeeeeee" Duration="0:0:0.2" /> <ColorAnimation Storyboard.TargetName="ButtonBorderGradientStop2" Storyboard.TargetProperty="Color" To="#ffcccccc" Duration="0:0:0.2" /> </Storyboard> <Storyboard x:Key="MouseDownAnimation"> <ColorAnimation Storyboard.TargetName="ButtonBorderGradientStop1" Storyboard.TargetProperty="Color" To="#ffc7c7ff" Duration="0:0:0.1" /> <ColorAnimation Storyboard.TargetName="ButtonBorderGradientStop2" Storyboard.TargetProperty="Color" To="#ff9a9aff" Duration="0:0:0.1" /> </Storyboard> <Storyboard x:Key="MouseUpAnimation"> <ColorAnimation Storyboard.TargetName="ButtonBorderGradientStop1" Storyboard.TargetProperty="Color" To="#ffefefff" Duration="0:0:0.1" /> <ColorAnimation Storyboard.TargetName="ButtonBorderGradientStop2" Storyboard.TargetProperty="Color" To="#ffc7c7ff" Duration="0:0:0.1" /> </Storyboard> </ControlTemplate.Resources> <Border x:Name="ButtonBorder" CornerRadius="0" BorderBrush="#55aaaaaa" BorderThickness="1" Width="23" Height="22"> <Border.Background> <LinearGradientBrush StartPoint="0,0" EndPoint="0,1"> <GradientBrush.GradientStops> <GradientStop x:Name="ButtonBorderGradientStop1" Color="#ffeeeeee" Offset="0.0" /> <GradientStop x:Name="ButtonBorderGradientStop2" Color="#ffcccccc" Offset="1.0" /> </GradientBrush.GradientStops> </LinearGradientBrush> </Border.Background> <Image x:Name="ButtonIcon" Source="icons/searchicon_bw.png" Width="16" Height="16" /> </Border> <ControlTemplate.Triggers> <Trigger Property="IsMouseOver" Value="True"> <Trigger.EnterActions> <BeginStoryboard Storyboard="{StaticResource MouseOverAnimation}" /> </Trigger.EnterActions> <Trigger.ExitActions> <BeginStoryboard Storyboard="{StaticResource MouseOutAnimation}" /> </Trigger.ExitActions> </Trigger> <Trigger Property="IsPressed" Value="True"> <Trigger.EnterActions> <BeginStoryboard Storyboard="{StaticResource MouseDownAnimation}" /> </Trigger.EnterActions> <Trigger.ExitActions> <BeginStoryboard Storyboard="{StaticResource MouseUpAnimation}" /> </Trigger.ExitActions> </Trigger> </ControlTemplate.Triggers> </ControlTemplate>

    Read the article

  • mootools slideshow not working with JQuery. Need help !

    - by Shantanu Gupta
    I am working on a site http://tapasya.co.in where i just impemented mootools slideshow. But I noticed that menubar that i was using stopped working, it was supposed to drop horizontaly but it is not being displayed now. I have used jquery for it. Please see the source of the web page. What can be the problem ? Mootools conflicting with javascript or some other problem. If I tries to use $.noConflict() it throws me an error in script Uncaught TypeError: Object function (B,C){if(B&&B.$family&&B.uid){return B}var A=$type(B);return($[A])?$[A](B,C,this.document):null} has no method 'noConflict' I tried the given solution below. But it is not working. <script type="text/javascript" src="<%= ResolveUrl("~/Js/jquery-1.3.2.min.js") %>" ></script> <script type="text/javascript" src="<%= ResolveUrl("~/Scripts/SlideShow/js/mootools.js") %>"></script> <script type="text/javascript" src="<%= ResolveUrl("~/Scripts/SlideShow/js/slideshow.js") %>"></script> <script type="text/javascript" src="<%= ResolveUrl("~/Scripts/SlideShow/js/lightbox.js") %>"></script> <script type="text/javascript"> // <![CDATA[ $.noConflict(); var timeout = 500; var closetimer = 0; var ddmenuitem = 0; function ddmenu_open(){ ddmenu_canceltimer(); ddmenu_close(); ddmenuitem = $(this).find('ul').css('visibility', 'visible'); } function ddmenu_close(){ if(ddmenuitem) ddmenuitem.css('visibility', 'hidden'); } function ddmenu_timer(){ closetimer = window.setTimeout(ddmenu_close, timeout); } function ddmenu_canceltimer(){ if(closetimer){ window.clearTimeout(closetimer); closetimer = null; }} $(document).ready(function(){ $('#ddmenu > li').bind('mouseover', ddmenu_open) $('#ddmenu > li').bind('mouseout', ddmenu_timer) }); document.onclick = ddmenu_close; // ]]> </script> <script type="text/javascript"> //<![CDATA[ window.addEvent('domready', function(){ var data = { '1.jpg': { caption: 'Acoustic Guitar,electric,bass,keyboard, indian vocal traning and Music theory.' }, '2.jpg': { caption: 'Acoustic Guitar,electric,bass,keyboard, indian vocal traning and Music theory.' }, '3.jpg': { caption: 'Acoustic Guitar,electric,bass,keyboard, indian vocal traning and Music theory.' }, '4.jpg': { caption: 'Acoustic Guitar,electric,bass,keyboard, indian vocal traning and Music theory.' } }; // Note the use of "linked: true" which tells Slideshow to auto-link all slides to the full-size image. //http://code.google.com/p/slideshow/wiki/Slideshow#Options: var mootoolsSlideshow = new Slideshow('divbanner', data, {loader:true,captions: true, delay: 5000,controller: false, height: 370,linked: false, hu: '<%= ResolveUrl("~/Scripts/SlideShow/Images/") %>', thumbnails: true, width: 1002}); // Here we create the Lightbox instance. // In this case we will use the "close" and "open" callbacks to pause our show while the modal window is visible. var box = new Lightbox({ 'onClose': function(){ this.pause(false); }.bind(mootoolsSlideshow), 'onOpen': function(){ this.pause(true); }.bind(mootoolsSlideshow) }); }); //]]> </script>

    Read the article

  • $.noConflict() not working with mootools slide show. Need help !

    - by Shantanu Gupta
    I am working on a site http://tapasya.co.in where i just impemented mootools slideshow. But I noticed that menubar that i was using stopped working, it was supposed to drop horizontaly but it is not being displayed now. I have used jquery for it. Please see the source of the web page. What can be the problem ? Mootools conflicting with javascript or some other problem. If I tries to use $.noConflict() it throws me an error in script Uncaught TypeError: Object function (B,C){if(B&&B.$family&&B.uid){return B}var A=$type(B);return($[A])?$[A](B,C,this.document):null} has no method 'noConflict' I tried the given solution below. But it is not working. <script type="text/javascript" src="<%= ResolveUrl("~/Js/jquery-1.3.2.min.js") %>" ></script> <script type="text/javascript" src="<%= ResolveUrl("~/Scripts/SlideShow/js/mootools.js") %>"></script> <script type="text/javascript" src="<%= ResolveUrl("~/Scripts/SlideShow/js/slideshow.js") %>"></script> <script type="text/javascript" src="<%= ResolveUrl("~/Scripts/SlideShow/js/lightbox.js") %>"></script> <script type="text/javascript"> // <![CDATA[ $.noConflict(); var timeout = 500; var closetimer = 0; var ddmenuitem = 0; function ddmenu_open(){ ddmenu_canceltimer(); ddmenu_close(); ddmenuitem = $(this).find('ul').css('visibility', 'visible'); } function ddmenu_close(){ if(ddmenuitem) ddmenuitem.css('visibility', 'hidden'); } function ddmenu_timer(){ closetimer = window.setTimeout(ddmenu_close, timeout); } function ddmenu_canceltimer(){ if(closetimer){ window.clearTimeout(closetimer); closetimer = null; }} $(document).ready(function(){ $('#ddmenu > li').bind('mouseover', ddmenu_open) $('#ddmenu > li').bind('mouseout', ddmenu_timer) }); document.onclick = ddmenu_close; // ]]> </script> <script type="text/javascript"> //<![CDATA[ window.addEvent('domready', function(){ var data = { '1.jpg': { caption: 'Acoustic Guitar,electric,bass,keyboard, indian vocal traning and Music theory.' }, '2.jpg': { caption: 'Acoustic Guitar,electric,bass,keyboard, indian vocal traning and Music theory.' }, '3.jpg': { caption: 'Acoustic Guitar,electric,bass,keyboard, indian vocal traning and Music theory.' }, '4.jpg': { caption: 'Acoustic Guitar,electric,bass,keyboard, indian vocal traning and Music theory.' } }; // Note the use of "linked: true" which tells Slideshow to auto-link all slides to the full-size image. //http://code.google.com/p/slideshow/wiki/Slideshow#Options: var mootoolsSlideshow = new Slideshow('divbanner', data, {loader:true,captions: true, delay: 5000,controller: false, height: 370,linked: false, hu: '<%= ResolveUrl("~/Scripts/SlideShow/Images/") %>', thumbnails: true, width: 1002}); // Here we create the Lightbox instance. // In this case we will use the "close" and "open" callbacks to pause our show while the modal window is visible. var box = new Lightbox({ 'onClose': function(){ this.pause(false); }.bind(mootoolsSlideshow), 'onOpen': function(){ this.pause(true); }.bind(mootoolsSlideshow) }); }); //]]> </script>

    Read the article

  • jScrollPane jEditable DOM problems

    - by Kyle Lafkoff
    Hello world, I am having a funky problem. See (this link won't disappear): www.skitzo.org/~el/bugjeditable.png for the firebug output screenshot. Here's my code. I run getJSON() to fetch the info from the PHP which pulls from DB and I fill a div with the result. I have jScrollPane and jEditable so a user can scroll down and click to edit any of the content. It works sometimes and then it doesn't work which makes me wonder if the browser is not interpreting the code properly or if I am misunderstanding fundamental DOM concepts here.... Here is a live current version of the code: http://www.musedates.com/testing.php $().ready(function() { $('#pane1').jScrollPane(); $('#tab_journal').tabs(); $('#tab2').load("/journal_new.php"); var i=0; var row = ''; var k, v, dt; $.getJSON("/ajax.php?j=22", function(data) { row = '<p>'; while(i<data.length) { $.each(data[i], function(k, v) { if (k == 'subject') { row += '<div style="font-size:1.5em; color:#000000;"><div class="editable" style="width:705px;" id="title-'+data[i].id+'">'+v+'</div></div>posted: '+dt+'<br />'; } else if (k == 'dt') { dt = v; } else if (k == 'msg') { row += '<div class="editableMsg" style="width:705px; height:40px;" id="msg-'+data[i].id+'">'+v+'</div></p>'; } }); i++; } $('#pane1').append(row).jScrollPane({scrollbarWidth:10, scrollbarMargin:10, showArrows:true}); }); $('.editable').livequery(function () { $('.editable').editable("/savejournal.php", { submitdata : function() { }, tooltip : 'Click to edit', indicator : '<img src="/UI/images/indicator.gif">', cancel : 'Cancel', submit : 'OK' }); $('.editableMsg').editable("/savejournal.php", { submitdata : function() { }, tooltip: 'Click to edit', indicator : '<img src="/UI/images/indicator.gif">', cancel : 'Cancel', submit : 'OK', type : 'textarea' }); $(".editable,.editableMsg").mouseover(function() { $(this).css('background-color', '#FDD017'); }); $(".editable,.editableMsg").mouseout(function() { $(this).css('background-color', '#fff'); }); }); }); And then the HTML: <div id="tab_container" style="margin:0px 0px 2px 8px;"> <ul id="tab_journal"> <li><a href="#tab1"><span>View / Edit</span></a></li> <li><a href="#tab2"><span>New Entry</span></a></li> </ul> </div> <div id="tab1" style="margin:0px 0px 0px 8px;"> <div id="pane1" class="scroll-pane super-wide"></div> </div> <div id="tab2" style="margin:0px 0px 0px 8px; width:700px;"></div> Thanks world.

    Read the article

  • How to drill down with jQuery?

    - by Timothy Reed
    I'm new to jQuery so sorry if this sounds stupid but I'm having truble drilling down to other elemnts. Paticularly I want to fade in the .menu li a:hover class with jquery. .menu { padding:0; margin:0; list-style:none; } .menu li { float:left; margin-left:1px; } .menu li a { display:block; height:44px; line-height:40px; padding:0 5px; float:right; color:#fff; text-decoration:none; font-family:"Palatino Linotype", "Book Antiqua", Palatino, serif; font-size:12px; font-weight:bold; } .menu li a b { text-transform:uppercase; } .menu li a:hover { color:#E4FFC5; background: url(../images/arrow.png) no-repeat center bottom; } .current { background: url(../images/arrow.png) no-repeat center bottom; font-size:16px; font-weight:bold; } .spacer p { display:block; height:44px; line-height:40px; padding:0 5px; float:right; color:#fff; text-decoration:none; font-family:"Palatino Linotype", "Book Antiqua", Palatino, serif; font-size:12px; font-weight:bold; } <ul class="menu"> <li class="current"><a href="index.html">Home</a></li> <li class="spacer"> <p>|</p> </li> <li><a href="#">Mission &amp; Values </a></li> <li class="spacer"> <p>|</p> </li> <li><a href="#">Caregivers</a></li> <li class="spacer"> <p>|</p> </li> <li><a href="#">Special Programs </a></li> <li class="spacer"> <p>|</p> </li> <li><a href="#">Enployment</a></li> <li class="spacer"> <p>|</p> </li> <li><a href="#">Contact</a></li> </ul> <script type="text/javascript"> $(function() { $('a').mouseover(function() { $('.logo').animate ({opacity:'0.6'}, 'normal'); }); $('a').mouseout (function() { $('.logo').animate ({opacity:'1'}, 'normal'); $('.menu li a:hover').fadeIn ('slow'); }); </script>

    Read the article

  • Hover/Fadeto/Toggle Multiple Class Changing

    - by Slick Willis
    So my problem is rather simple and complex at the same time. I am trying to create links that fade in when you mouseover them and fade out when you mouseout of them. At the same time that you are going over them I would like a pic to slide from the left. This is the easy part, I have every thing working. The image fades and another image slides. I did this by using a hover, fadeto, and toggle("slide"). I would like to do this in a table format with multiple images being able to be scrolled over and sliding images out. The problem is that I am calling my sliding image to a class and when I hover over the letters both images slide out. Does anybody have a solution for this? I posted the code that I used below: <html> <head> <script type='text/javascript' src='http://accidentalwords.squarespace.com/storage/jquery/jquery-1.4.2.min.js'></script> <script type='text/javascript' src='http://accidentalwords.squarespace.com/storage/jquery/jquery-custom-181/jquery-ui-1.8.1.custom.min.js'></script> <style type="text/css"> .text-slide { display: none; margin: 0px; width: 167px; height: 50px; } </style> <script> $(document).ready(function(){ $(".letterbox-fade").fadeTo(1,0.25); $(".letterbox-fade").hover(function () { $(this).stop().fadeTo(250,1); $(".text-slide").toggle("slide", {}, 1000); }, function() { $(this).stop().fadeTo(250,0.25); $(".text-slide").toggle("slide", {}, 1000); }); }); </script> </head> <body style="background-color: #181818"> <table> <tr> <td><div class="letterbox-fade"><img src="http://accidentalwords.squarespace.com/storage/sidebar/icons/A-Letterbox-Selected.png" /></div></td> <td><div class="text-slide"><img src="http://accidentalwords.squarespace.com/storage/sidebar/icons/TEST.png" /></div></td> </tr> <tr> <td><div class="letterbox-fade"><img src="http://accidentalwords.squarespace.com/storage/sidebar/icons/B-Letterbox-Selected.png" /></div></td> <td><div class="text-slide"><img src="http://accidentalwords.squarespace.com/storage/sidebar/icons/TEST.png" /></div></td> </tr> </table> </body> </html>

    Read the article

  • jQuery make child div visible on hover (on effective li element only, not parent!)

    - by Dennis
    I've already tried all of the existing posts related to this, but they doesn't work as I want it... The HTML: <ol class="sortable"> <li> <div> <a href="#">Start Page</a> <div class="li_options"> <a href="#"><img src="img/icons/small_add.png" /></a> <a href="#" onClick="[..]"><img src="img/icons/small_remove.png" /></a> </div> <div class="clear"></div> </div> <ol> <li> <div> <a href="#">Sub Seite</a> <div class="li_options"> <a href="#"><img src="img/icons/small_add.png" /></a> <a href="#" onClick="[..]"><img src="img/icons/small_remove.png" /></a> </div> <div class="clear"></div> </div> <ol> <li> <div> <a href="#">Sub Sub Seite</a> <div class="li_options"> <a href="#"><img src="img/icons/small_add.png" /></a> <a href="#" onClick="[..]"><img src="img/icons/small_remove.png" /></a> </div> <div class="clear"></div> </div> </li> </ol> </li> </ol> </li> <div class="clear"></div> This should look like this: Start Page Sub Page Sub Page I want the div.li_options which is set for every li element to be shown only on hovering element. I know, that the parent's li is also being "hovered" on hovering child elements, but I don't those "li_options" to be displayed. The best solution so far: $(document).ready(function() { $('.sortable li').mouseover(function() { $(this).children().children('.li_options').show(); }).mouseout(function() { $(this).children().children('.li_options').hide(); }); }); But with this, parents aren't being excluded... I don't know how to point on them, because there can be endless levels. Do you know how to get this working?

    Read the article

  • jQuery animation menu height

    - by StealthRT
    Hey all i have the following jsfiddle Fiddle that i need some help on. When i have my mouse over it-it expands out to a static width but, depending on the text length, it grabs it by the inner's text $('.inner').height(). Problem being is that it goes a little too far beyond the last text list item and when i roll over any of the text in the menu box it slides back up a little. How can prevent it from (1) sliding back up and (2) have the exact height needed without even having the extra space at the bottom of the box for its height? The JS: $(document).ready(function() { $('#menuSquare, .inner').mouseout(function() { theMenu('close'); }); $('#menuSquare, .inner').mouseover(function() { theMenu('open'); }); }); function theMenu(what2Do) { if (what2Do == 'open') { $('#menuSquare').stop().animate({ width: 190, //95 height: $('.inner').height(), duration:900, 'padding-top' : 10, 'padding-right' : 10, 'padding-bottom' : 10, 'padding-left' : 10, backgroundColor: '#fff', opacity: 0.8 }, 1000,'easeOutCubic') } else { $('#menuSquare').stop().animate({ width: "20", height: "20", padding: '0px', backgroundColor: '#e51937', opacity: 0.8 }, 500,'easeInCirc') } }? The HTML: <div id="menuSquare" class="TheMenuBox" style="overflow: hidden; width: 20px; height: 20px; background-color: rgb(229, 25, 55); opacity: 0.8; padding: 0px;"> <div class="inner"> <p style="text-decoration:none; color:#666; cursor: pointer; " onclick="changeImg('Custom Homes');">Custom Homes</p> <p style="text-decoration:none; color:#666; cursor: pointer; " onclick="changeImg('Full Service Hotels');">Full Service Hotels</p> <p style="text-decoration:none; color:#666; cursor: pointer; " onclick="changeImg('Mixed Use');">Mixed Use</p> <p style="text-decoration:none; color:#666; cursor: pointer; " onclick="changeImg('Office');">Office</p> <p style="text-decoration:none; color:#666; cursor: pointer; " onclick="changeImg('Retail');">Retail</p> <p style="text-decoration:none; color:#666; cursor: pointer; " onclick="changeImg('Select Service Hotels');">Select Service Hotels</p> </div> </div>

    Read the article

  • Image change on mouseover with jQuery..

    - by playahabana
    Hi, I am a comlete beginner to pretty much all things web design and am trying to construct my first website. I am attempting to hand code it without the ue of a CMS in order to learn as much as possible as quickly as possible. I am trying to make an imge change on mouseover for my top nav menu, and have the following jQuery functions: $(document).ready(function(){ $(".navlist img").each(function) { rollsrc = $(this).attr("src"); rollON = rollsrc.replace(/.jpg$/ig,"_link.png"); $("<img>").attr("src",rollON); $(".navlist a").mouseover(function(){ }); imgsrc= $(this).children("img").attr("src"); matches = imgsrc.match(/_link.png); if (!matches) { imgsrcON = imgsrc.replace(/.jpg$/ig,"_link.png"); $(this).children("img").attr("src", imagesrcON); } $(".navlist a").mouseout(function(){ $(this).children("img").attr("src", imgsrc); }); }); my html is as follows: <div id="nav"> <ul class="navmenu"> <li><a href="index.html"><img class="swap" src="images/links/home.jpg" alt="Home" border="none"></a></li> <li><a href="#"><img class="swap" src="images/links/ourbar.jpg" alt="Our Bar" border="none"></a> <ul class="navdrop"> <li ><a href="#"><img class="swap" src="images/links/cockteles.jpg" alt="Our Cocktails" border="none"></a></li> <li ><a href="#"><img class="swap" src="images/links/celebrate.jpg" alt="Celebrate in Style" border="none"></a></li> </ul> </li> <li><a href="#"><img class="swap" src="images/links/ourcigars.jpg" alt="Our Cigars" border="none"></a> <ul class="navdrop"> <li><a href="#"><img class="swap" src="images/links/edicionlimitadas.jpg" alt="Edition Limitadas" border="none"></a></li> <li><a href="our_cigars.html"><img class="swap" src="images/links/cigartasting.jpg" alt="Cigar Tastings" border="none"></a></li> </ul> </li> <li><a href="#"><img class="swap" src="images/links/personalcigar.jpg" alt="Personal Cigar Roller" border="none"></a></li> <li><a href="our_cigars.html"><img class="swap" src="images/links/photogallery.jpg" alt="Photo Gallery" border="none"></a></li> <li><a href="#"><img class="swap" src="images/links/contactus.jpg" alt="Contact Us" border="none"></a></li> </ul></div></div><!--end banner--> the image src for the alt image is in the form eg."images/links/home_link.png" and is the same for every image. I have checked this and checked this, could some body please give me a pointer as to where I am going wrong? Or a pointer to a tutorial for this effect? I have looked at a few and this seems to be the best for what I am attempting, but as I said I don't really know what I'm doing so any advice gratefully received.....

    Read the article

  • jQuery UI Tabs Plugin Broke

    - by Warren J Thompson
    We are using the jquery ui tabs arrow plugin from this fiddle: http://jsfiddle.net/dECtZ/282/, but like many plugins, it breaks with the latest version of jQuery. We were able to get the csscur to work, but still get the following error in the jquery core (line 353): Uncaught TypeError: Cannot assign to read only property 'length' of function (e,t){if(!this._createWidget)return new o(e,t);arguments.length&&this._createWidget(e,t)} Code is as follows: (function($, undefined) { if (!$.xui) { $.xui = {}; } var tabs = $.extend({}, $.ui.tabs.prototype), _super = { _create: tabs._create, _destroy: tabs._destroy, _update: tabs._update }; $.xui.tabs = $.extend(tabs, { options: $.extend({}, tabs.options, { scrollable: false, changeOnScroll: false, closable: false, resizable: false, resizeHandles: "e,s,se" }), _create: function() { var self = this, o = self.options; _super._create.apply(self); if (o.scrollable) { self.element.addClass("ui-tabs-scrollable"); var scrollContainer = $('<div class="ui-tabs-scroll-container"></div>').prependTo(this.element); self.header = $('<div class="ui-tabs-nav-scrollable ui-widget-header ui-corner-all"></div>').prependTo(scrollContainer); var nav = self.element.find(".ui-tabs-nav:first").removeClass("ui-widget-header ui-corner-all").appendTo(this.header); var arrowsNav = $('<ol class="ui-helper-reset ui-helper-clearfix ui-tabs-nav-arrows"></ol>').prependTo(self.element); var navPrev = $('<li class="ui-tabs-arrow-previous ui-state-default ui-corner-bl ui-corner-tl" title="Previous"><a href="#"><span class="ui-icon ui-icon-carat-1-w">Previous tab</span></a></li>').prependTo(arrowsNav).hide(), navNext = $('<li class="ui-tabs-arrow-next ui-state-default ui-corner-tr ui-corner-br" title="Next"><a href="#"><span class="ui-icon ui-icon-carat-1-e">Next tab</span></a></li>').appendTo(arrowsNav).hide(); var scrollTo = function(to, delay) { var navWidth = 0, arrowWidth = navPrev.outerWidth(), marginLeft = -(parseInt(nav.css("marginLeft"), 10)), hwidth = self.header.width(), newMargin = 0; nav.find("li").each(function() { navWidth += $(this).outerWidth(true); }); if (to instanceof $.Event) { } else { newMargin = marginLeft+to; if (newMargin > (navWidth-hwidth)) { newMargin = (navWidth-hwidth); } else if (newMargin < 0) { newMargin = 0; } nav.stop(true).animate({ marginLeft: -(newMargin) }, delay, function(){ $(window).trigger("resize.tabs"); }); } } var holdTimer = false; navPrev.add(navNext).bind({ "click": function(e) { var isNext = this === navNext[0]; e.preventDefault(); if (o.changeOnScroll) { self.select(self.options.selected + (isNext ? 1 : -1)); } else { if (!holdTimer) scrollTo(isNext ? 150 : -150, 250); } }, "mousedown": function(e){ if (!o.changeOnScroll) { var isNext = this === navNext[0], duration = 10, pos = 15, timer; if (holdTimer) clearTimeout(holdTimer); holdTimer = setTimeout(timer = function(){ scrollTo(isNext ? pos : -(pos), duration); holdTimer = setTimeout(arguments.callee, duration); }, 150); } }, "mouseup mouseout": function(e){ if (!o.changeOnScroll) { clearTimeout(holdTimer); holdTimer = false; nav.stop(); } } }); self.header.bind('mousewheel', function(e, d, dX, dY) { e.preventDefault(); if (d === -1) { navNext.click(); } else if (d === 1) { navPrev.click(); } }); $(window).bind("resize.tabs", function(e) { var navWidth = 0; var arrowWidth = navPrev.outerWidth(); nav.find("li").each(function() { navWidth += $(this).outerWidth(true); }); var marginLeft = -(parseInt(nav.css("marginLeft"), 10)), hwidth = self.header.width(); if (navWidth > (hwidth+marginLeft)) { self.header.addClass("ui-tabs-arrow-r"); navNext.show("fade"); if (marginLeft > 0) { self.header.addClass("ui-tabs-arrow-l"); navPrev.show("fade"); } else { self.header.removeClass("ui-tabs-arrow-l"); navPrev.hide("fade"); } } else { self.header.removeClass("ui-tabs-arrows ui-tabs-arrow-l"); navNext.hide("fade"); if (marginLeft > 0) { self.header.addClass("ui-tabs-arrow-l"); navPrev.show("fade"); } else { self.header.removeClass("ui-tabs-arrow-l"); navPrev.hide("fade"); } } }).trigger("resize.tabs"); arrowsNav.find("li").bind({ "mouseenter focus": function(e) { $(this).addClass("ui-state-hover"); }, "mouseleave blur": function(e) { $(this).removeClass("ui-state-hover"); } }); this.anchors.bind("click.tabs", function(){ var li = $(this).parent(), arrowWidth = navPrev.outerWidth(), width = li.outerWidth(true), hwidth = self.header.width(), pos = li.position().left, marginLeft = -(parseInt(nav.stop(true,true).css("marginLeft"),10)), newMargin = -1; if (li.index() === 0) { newMargin = 0; } else if ((pos+width) >= (hwidth+marginLeft)) { newMargin = pos-hwidth+width; if ((li.index()+1) < nav.find("li").length) { newMargin += arrowWidth; } } else if (pos < marginLeft) { newMargin = pos-arrowWidth; } if (newMargin > -1) { nav.animate({ marginLeft: -(newMargin) }, 250, function(){ $(window).trigger("resize.tabs"); }); } }); } return self; }, _update: function(){ console.log(arguments); _super._update.apply(this); } }); $.widget("xui.tabs", $.xui.tabs); })(jQuery); $(function() { $("#tabs").tabs({ scrollable: true, changeOnScroll: false, closable: true }); $("#switcher").themeswitcher(); });

    Read the article

  • jquery hover not working properly other than IE6

    - by Kranthi
    Hi All, We developed navigation bar using jQuery 1.4.2. Functionality is to show submneus for different menu items when user hovers on it. It is working perfectly in IE6 but we see some weird problems in other browsers. In Firefox, when the page gets loaded, it works fine but when we hit f5, the submenu wont appear on hover. To get submenu we need to click on any other menu item. In Chrome, its the same to add on, some time even we click on any menu item, and hover submenu wont show up. In Safari, nothing shows up most of the times, but on clicking 5-6 menu items, submenu is shown.When we see loading text in safari it shows the submenu. but on every click the loading text wont appear.. We are very much confused..is it the browser behavior/code/jquery?? Below is the snippet: Html: <ul> <li><a class="mainLinks" href="google.com">Support</a> <ul><li>Sublink1</li></ul> </ul> Html code is absolutely fine. Jquery: var timeout = null; var ie = (document.all) ? true : false; $(document).ready(function(){ var $mainLink = null; var $subLink = null; $(".mainLinks").each(function(){ if ($(this).hasClass("current")) { $(this).mouseout(function() { var $this = $(this); timeout = setTimeout(function() { $(".popUpNav", $this.parent()).css({ visibility : 'hidden' }); $('.popUpArrow').hide(); ieCompat('show'); }, 200); }); } else { $(this).hover(function() { reset(); ieCompat('hide'); // Saving this for later use in the popUpNav hover event $mainLink = $(this); $popUpNav = $(".popUpNav", $mainLink.parent()); // Default width is width of one column var popupWidth = $('.popUpNavSection').width() + 20; // Calculate popup width depending on the number of columns var numColumns = $popUpNav.find('.popUpNavSection').length; if (numColumns != 0) { popupWidth *= numColumns; } var elPos = $mainLink.position(); var leftOffset = 0; if (elPos.left + popupWidth > 950) { leftOffset = elPos.left + popupWidth - 948; } $popUpNav.css({ top : elPos.top + 31 + 'px', left : elPos.left - leftOffset + 'px', visibility : 'visible', width : popupWidth + 'px' }); $('.popUpArrow').css({ left : elPos.left + Math.round(($mainLink.width() / 2)) + 20 + 'px', top : '27px' }).show(); }, function() { var $this = $(this); timeout = setTimeout(function() { $(".popUpNav", $this.parent()).css({ visibility : 'hidden' }); $('.popUpArrow').hide() ieCompat('show'); }, 200); } ); } }); $(".subLinks").hover( function(e) { $subLink = $(this); var elPos = $subLink.position(); var popupWidth = $(".popUpNavLv2",$subLink.parent()).width(); var leftOffset = 0; ieCompat('hide'); $(".popUpNavLv2",$subLink.parent()).css({ top : elPos.top + 32 + 'px', left : elPos.left - leftOffset + 'px', visibility : 'visible' }); }, function() { var $this = $(this); timeout = setTimeout(function() { $(".popUpNavLv2", $this.parent()).css({ visibility : 'hidden' }); }, 200); ieCompat('show'); } ); $('.popUpNav').hover( function() { clearTimeout(timeout); $mainLink.addClass('current'); $(this).css('visibility', 'visible'); $('.popUpArrow').show(); }, function() { $mainLink.removeClass('current'); $(this).css('visibility', 'hidden'); $('.popUpArrow').hide(); ieCompat('show'); } ); $('.popUpNavLv2').hover( function() { clearTimeout(timeout); $(this).css('visibility', 'visible'); ieCompat('hide'); }, function() { ieCompat('show'); $(this).css('visibility', 'hidden'); } ); // If on mac, reduce left padding on the tabs if (/mac os x/.test(navigator.userAgent.toLowerCase())) { $('.mainLinks, .mainLinksHome').css('padding-left', '23px'); } }); Thanks a lot in advance for looking into it. Thanks | Kranthi

    Read the article

  • jQuery ajax doesn't seem to be reading HTML data in Chromium

    - by Mahesh
    I have an HTML (App) file that reads another HTML (data) file via jQuery.ajax(). It then finds specific tags in the data HTML file and uses text within the tags to display sort-of tool tips. Here's the App HTML file: <!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" lang="en-US" xml:lang="en-US"> <head> <title>Test</title> <style type="text/css"> <!--/* <![CDATA[ */ body { font-family : sans-serif; font-size : medium; margin-bottom : 5em; } a, a:hover, a:visited { text-decoration : none; color : #2222aa; } a:hover { background-color : #eeeeee; } #stat_preview { position : absolute; background : #ccc; border : thin solid #aaa; padding : 3px; font-family : monospace; height : 2.5em; } /* ]]> */--> </style> <script type="text/javascript" src="http://code.jquery.com/jquery-1.4.2.min.js"></script> <script type="text/javascript"> //<![CDATA[ $(document).ready(function() { $("#stat_preview").hide(); $(".cfg_lnk").mouseover(function () { lnk = $(this); $.ajax({ url: lnk.attr("href"), success: function (data) { console.log (data); $("#stat_preview").html("A heading<br>") .append($(".tool_tip_text", $(data)).slice(0,3).text()) .css('left', (lnk.offset().left + lnk.width() + 30)) .css('top', (lnk.offset().top + (lnk.height()/2))) .show(); } }); }).mouseout (function () { $("#stat_preview").hide(); }); }); //]]> </script> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> </head> <body> <h1>Test</h1> <ul> <li><a class="cfg_lnk" href="data.html">Sample data</a></li> </ul> <div id="stat_preview"></div> </body> </html> And here is the data HTML <!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" lang="en-US" xml:lang="en-US"> <head> <title>Test</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> </head> <body> <h1>Test</h1> <table> <tr> <td class="tool_tip_text"> Some random value 1</td> <td class="tool_tip_text"> Some random value 2</td> <td class="tool_tip_text"> Some random value 3</td> <td class="tool_tip_text"> Some random value 4</td> <td class="tool_tip_text"> Some random value 5</td> </tr> <tr> <td class="tool_top_text"> Some random value 11</td> <td class="tool_top_text"> Some random value 21</td> <td class="tool_top_text"> Some random value 31</td> <td class="tool_top_text"> Some random value 41</td> <td class="tool_top_text"> Some random value 51</td> </tr> </table> </body> </html> This is working as intended in Firefox, but not in Chrome (Chromium 5.0.356.0). The console.log (data) displays empty string in Chromium's JavaScript console. Firebug in Firefox, however, displays the entire data HTML. Am I missing something? Any pointers?

    Read the article

  • jQuery toggle fucntion not working as expected

    - by Bunny Rabbit
    <!DOCTYPE html> <html lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3/jquery.min.js" type="text/javascript"></script> <script type="text/javascript"> $(function(){ $('div#menu div') .bind('mouseover',function(event){ popHelp(this); }) .bind('mouseout',function(event){ clearHelp(); }) .toggle( function(event){$('#menu div a').not(this).css('opacity',1);$(event.target).css('opacity',0.4)}, function(event){$(event.target).css('opacity',1)} ) $('div.item').not('#mainPage') .hide() $('#customerManagement').click(function(event){ $('.item').hide('slow'); $('#customerManagementCon').toggle('slow'); return false; }) $('#userManagement').click(function(){ $('.item').hide('slow'); $('#userManagementCon').toggle('slow'); return false; }) $('#storageManagement').click(function(){ $('.item').hide('slow'); $('#storageManagementCon').toggle('slow'); return false; }) $('#searchManagement').click(function(){ $('.item').hide('slow'); $('#searchManagementCon').toggle('slow'); return false; }) $('#signOff').click(function(){ $('.item').hide('slow'); $('#signOffCon').toggle('slow'); return false; }) } ); function popHelp(ref){ var text; if(ref.id=="customerManagement") text="click here for customer management"; else if(ref.id=="userManagement") text="click here for user management"; else if(ref.id=="storageManagement") text="click here for storage management"; else if(ref.id=="searchManagement") text="search management"; else if(ref.id=="signOff") text="click here to sign off"; $('#helpConsole').append('<div class="help">'+text+'<div>'); } function clearHelp(){ $('#helpConsole > div').remove(); } </script> <style type="text/css" > #helpConsole { background-color:Aqua; margin-left:500px; width:300px; height:100px; outline-width:medium; } </style> </head> <body> <div id="menu"> <table border="2"> <thead> <tr> <th colspan="5">Welcome $Employee Name</th> </tr> </thead> <tbody> <tr> <td><div id="customerManagement" class="menuItem"><a>Customer Management</a></div></td> <td><div id="userManagement" class="menuItem"><a>User Management</a></div></td> <td><div id="storageManagement" class="menuItem"><a>Storage Management</a></div></td> <td><div id="searchManagement" class="menuItem"><a>Search Management</a></div></td> <td><div id="signOff" class="menuItem"><a>Sign Off</a></div></td> </tr> </tbody> </table> </div> <div id="helpConsole"><h3>help</h3></div> <div id="mainPage" class="item"><h1>Storage Service</h1></div> <div id="customerManagementCon" class="item"> <h3>Customer Management</h3> </div> <div id="userManagementCon" class="item"> <h3>User Management</h3> </div> <div id="storageManagementCon" class="item"> <h3>Storage Management</h3> </div> <div id="searchManagementCon" class="item"> <h3>Search Mangement</h3> </div> <div id="signOffCon" class="item"> <h3>Sign Off</h3> </div> <div id="menuItemCon" class="item">menuItem</div> </body> The toggle function in this code is not working as expected though it shows the #menu items when clicked it doesn't hide them always .

    Read the article

  • Possible to manipulate UI elements via dispatchEvent()?

    - by rinogo
    Hi all! I'm trying to manually dispatch events on a textfield so I can manipulate it indirectly via code (e.g. place cursor at a given set of x/y coordinates). However, my events seem to have no effect. I've written a test to experiment with this phenomenon: package sandbox { import flash.display.Sprite; import flash.events.MouseEvent; import flash.text.TextField; import flash.text.TextFieldType; import flash.text.TextFieldAutoSize; import flash.utils.setTimeout; public class Test extends Sprite { private var tf:TextField; private var tf2:TextField; public function Test() { super(); tf = new TextField(); tf.text = 'Interact here'; tf.type = TextFieldType.INPUT; addChild(tf); tf2 = new TextField(); tf2.text = 'Same events replayed with five second delay here'; tf2.autoSize = TextFieldAutoSize.LEFT; tf2.type = TextFieldType.INPUT; tf2.y = 30; addChild(tf2); tf.addEventListener(MouseEvent.CLICK, mouseListener); tf.addEventListener(MouseEvent.DOUBLE_CLICK, mouseListener); tf.addEventListener(MouseEvent.MOUSE_DOWN, mouseListener); tf.addEventListener(MouseEvent.MOUSE_MOVE, mouseListener); tf.addEventListener(MouseEvent.MOUSE_OUT, mouseListener); tf.addEventListener(MouseEvent.MOUSE_OVER, mouseListener); tf.addEventListener(MouseEvent.MOUSE_UP, mouseListener); tf.addEventListener(MouseEvent.MOUSE_WHEEL, mouseListener); tf.addEventListener(MouseEvent.ROLL_OUT, mouseListener); tf.addEventListener(MouseEvent.ROLL_OVER, mouseListener); } private function mouseListener(event:MouseEvent):void { //trace(event); setTimeout(function():void {trace(event); tf2.dispatchEvent(event);}, 5000); } } } Essentially, all this test does is to use setTimeout to effectively 'record' events on TextField tf and replay them five seconds later on TextField tf2. When an event is dispatched on tf2, it is traced to the console output. The console output upon running this program and clicking on tf is: [MouseEvent type="mouseMove" bubbles=true cancelable=false eventPhase=3 localX=0 localY=1 stageX=0 stageY=1 relatedObject=null ctrlKey=false altKey=false shiftKey=false delta=0] [MouseEvent type="rollOver" bubbles=false cancelable=false eventPhase=2 localX=0 localY=1 stageX=0 stageY=1 relatedObject=null ctrlKey=false altKey=false shiftKey=false delta=0] [MouseEvent type="mouseOver" bubbles=true cancelable=false eventPhase=3 localX=0 localY=1 stageX=0 stageY=1 relatedObject=null ctrlKey=false altKey=false shiftKey=false delta=0] [MouseEvent type="mouseMove" bubbles=true cancelable=false eventPhase=3 localX=2 localY=1 stageX=2 stageY=1 relatedObject=null ctrlKey=false altKey=false shiftKey=false delta=0] [MouseEvent type="mouseMove" bubbles=true cancelable=false eventPhase=3 localX=2 localY=2 stageX=2 stageY=2 relatedObject=null ctrlKey=false altKey=false shiftKey=false delta=0] [MouseEvent type="mouseMove" bubbles=true cancelable=false eventPhase=3 localX=2 localY=3 stageX=2 stageY=3 relatedObject=null ctrlKey=false altKey=false shiftKey=false delta=0] [MouseEvent type="mouseMove" bubbles=true cancelable=false eventPhase=3 localX=3 localY=3 stageX=3 stageY=3 relatedObject=null ctrlKey=false altKey=false shiftKey=false delta=0] [MouseEvent type="mouseMove" bubbles=true cancelable=false eventPhase=3 localX=5 localY=3 stageX=5 stageY=3 relatedObject=null ctrlKey=false altKey=false shiftKey=false delta=0] [MouseEvent type="mouseMove" bubbles=true cancelable=false eventPhase=3 localX=6 localY=5 stageX=6 stageY=5 relatedObject=null ctrlKey=false altKey=false shiftKey=false delta=0] [MouseEvent type="mouseMove" bubbles=true cancelable=false eventPhase=3 localX=7 localY=5 stageX=7 stageY=5 relatedObject=null ctrlKey=false altKey=false shiftKey=false delta=0] [MouseEvent type="mouseMove" bubbles=true cancelable=false eventPhase=3 localX=9 localY=5 stageX=9 stageY=5 relatedObject=null ctrlKey=false altKey=false shiftKey=false delta=0] [MouseEvent type="mouseMove" bubbles=true cancelable=false eventPhase=3 localX=10 localY=5 stageX=10 stageY=5 relatedObject=null ctrlKey=false altKey=false shiftKey=false delta=0] [MouseEvent type="mouseMove" bubbles=true cancelable=false eventPhase=3 localX=11 localY=5 stageX=11 stageY=5 relatedObject=null ctrlKey=false altKey=false shiftKey=false delta=0] [MouseEvent type="mouseMove" bubbles=true cancelable=false eventPhase=3 localX=12 localY=5 stageX=12 stageY=5 relatedObject=null ctrlKey=false altKey=false shiftKey=false delta=0] [MouseEvent type="mouseDown" bubbles=true cancelable=false eventPhase=3 localX=12 localY=5 stageX=12 stageY=5 relatedObject=null ctrlKey=false altKey=false shiftKey=false delta=0] [MouseEvent type="mouseUp" bubbles=true cancelable=false eventPhase=3 localX=12 localY=5 stageX=12 stageY=5 relatedObject=null ctrlKey=false altKey=false shiftKey=false delta=0] [MouseEvent type="click" bubbles=true cancelable=false eventPhase=3 localX=12 localY=5 stageX=12 stageY=5 relatedObject=null ctrlKey=false altKey=false shiftKey=false delta=0] [MouseEvent type="mouseMove" bubbles=true cancelable=false eventPhase=3 localX=10 localY=4 stageX=10 stageY=4 relatedObject=null ctrlKey=false altKey=false shiftKey=false delta=0] [MouseEvent type="mouseMove" bubbles=true cancelable=false eventPhase=3 localX=9 localY=2 stageX=9 stageY=2 relatedObject=null ctrlKey=false altKey=false shiftKey=false delta=0] [MouseEvent type="mouseMove" bubbles=true cancelable=false eventPhase=3 localX=9 localY=1 stageX=9 stageY=1 relatedObject=null ctrlKey=false altKey=false shiftKey=false delta=0] [MouseEvent type="mouseOut" bubbles=true cancelable=false eventPhase=3 localX=-1 localY=-1 stageX=-1 stageY=-1 relatedObject=null ctrlKey=false altKey=false shiftKey=false delta=0] [MouseEvent type="rollOut" bubbles=false cancelable=false eventPhase=2 localX=-1 localY=-1 stageX=-1 stageY=-1 relatedObject=null ctrlKey=false altKey=false shiftKey=false delta=0] As we can see, the events are being captured and replayed successfully. However, no change occurs in tf2 - the mouse cursor does not appear in tf2 as we would expect. In fact, the cursor remains in tf even after the tf2 events are dispatched. Please help! Thanks, -Rich

    Read the article

  • Super Noob C++ variable help

    - by julian
    Ok, I must preface this by stating that I know so so little about c++ and am hoping someone can just help me out... I have the below code: string GoogleMapControl::CreatePolyLine(RideItem *ride) { std::vector<RideFilePoint> intervalPoints; ostringstream oss; int cp; int intervalTime = 30; // 30 seconds int zone =ride->zoneRange(); if(zone >= 0) { cp = 300; // default cp to 300 watts } else { cp = ride->zones->getCP(zone); } foreach(RideFilePoint* rfp, ride->ride()->dataPoints()) { intervalPoints.push_back(*rfp); if((intervalPoints.back().secs - intervalPoints.front().secs) > intervalTime) { // find the avg power and color code it and create a polyline... AvgPower avgPower = for_each(intervalPoints.begin(), intervalPoints.end(), AvgPower()); // find the color QColor color = GetColor(cp,avgPower); // create the polyline CreateSubPolyLine(intervalPoints,oss,color); intervalPoints.clear(); intervalPoints.push_back(*rfp); } } return oss.str(); } void GoogleMapControl::CreateSubPolyLine(const std::vector<RideFilePoint> &points, std::ostringstream &oss, QColor color) { oss.precision(6); QString colorstr = color.name(); oss.setf(ios::fixed,ios::floatfield); oss << "var polyline = new GPolyline(["; BOOST_FOREACH(RideFilePoint rfp, points) { if (ceil(rfp.lat) != 180 && ceil(rfp.lon) != 180) { oss << "new GLatLng(" << rfp.lat << "," << rfp.lon << ")," << endl; } } oss << "],\"" << colorstr.toStdString() << "\",4);"; oss << "GEvent.addListener(polyline, 'mouseover', function() {" << endl << "var tooltip_text = 'Avg watts:" << avgPower <<" <br> Avg Speed: <br> Color: "<< colorstr.toStdString() <<"';" << endl << "var ss={'weight':8};" << endl << "this.setStrokeStyle(ss);" << endl << "this.overlay = new MapTooltip(this,tooltip_text);" << endl << "map.addOverlay(this.overlay);" << endl << "});" << endl << "GEvent.addListener(polyline, 'mouseout', function() {" << endl << "map.removeOverlay(this.overlay);" << endl << "var ss={'weight':5};" << endl << "this.setStrokeStyle(ss);" << endl << "});" << endl; oss << "map.addOverlay (polyline);" << endl; } And I'm trying to get the avgPower from this part: AvgPower avgPower = for_each(intervalPoints.begin(), intervalPoints.end(), AvgPower()); the first part to cary over to the second part: << "var tooltip_text = 'Avg watts:" << avgPower <<" <br> Avg Speed: <br> Color: "<< colorstr.toStdString() <<"';" << endl But of course I haven't the slightest clue how to do it... anyone feeling generous today? Thanks in advance

    Read the article

  • How do would you use jQuery's .each() to apply the same script to each element with the same class?

    - by derekmx271
    I have a with multiple cart items listed. I have a "x-men logo" looking remove button that I want to fade-in next to the item when the customer hovers over a cart item. I had no issue getting this to work when there is only one item in the list. However, when there are multiple items in the cart, the jQuery operates funky. It still does the fade in, but only when I hover over the last item in the cart, and of course all of the "remove X" images become visible. Argh... So i searched around and think the .each() is my savior. I have been trying to get it to work, with no luck. My script just breaks when I attempt to implement it. Anyone have any pointers on this *.each() thing and how to implement it into my script?* I have tried putting a cartItem.each(function(){ around the mouseEnter/mouseLeave events (and used some $(this) selectors to make it "make sense") and that didn't do anything. Tried some other things as well with no luck... Here is the HTML (Sorry, there's a lot): <ul id="head-cart-items"> <!-- Item #1 --> <li> <!-- Item #1 Wrap --> <div class="head-cart-item"> <div class="head-cart-img" style='background-image:url("/viewimageresize.asp?mh=50&amp;mw=50&amp;p=AFE&amp;f=Air_Intakes_Magnum_FORCE_Stage-1_PRO_5R")'> </div> <div class="head-cart-desc"> <h3> <a href="/partdetails/AFE/Intakes/Air_Intakes/Magnum_FORCE_Stage-1_PRO_5R/19029">AFE Magnum FORCE Stage-1 PRO 5R Air Intakes</a> </h3> <span class="head-cart-qty">Qty: 1</span> <span class="head-cart-price">$195.00</span> <!-- Here is my Remove-X... --> <a class="remove-x" href='/cart//7806887'> <img src="/images/misc/remove-x.png"> </a> </div> </div> </li> <!-- Item #2 --> <li> <!-- Item #2 Wrap --> <div class="head-cart-item"> <div class="head-cart-img" style='background-image:url("/viewimageresize.asp?mh=50&amp;mw=50&amp;p=Exedy&amp;f=Clutch_Kits_Carbon-R")'> </div> <div class="head-cart-desc"> <h3> <a href="/partdetails/Exedy/Clutch/Clutch_Kits/Carbon-R/19684">Exedy Carbon-R Clutch Kits</a> </h3> <span class="head-cart-qty">Qty: 1</span> <span class="head-cart-price">$2,880.00</span> <!-- Here is my other Remove-X... --> <a class="remove-x" href='/cart//7806888'> <img src="/images/misc/remove-x.png"> </a> </div> </div> </li> </ul> And here is the jQuery... $(document).ready(function(){ var removeX = $(".remove-x"); var cartItem = $(".head-cart-item"); // Start with an invisible X removeX.fadeTo(0,0); // When hovering over Cart Item cartItem.mouseenter(function(){ // Fade the X to 100% removeX.fadeTo("normal",1); // On mouseout, fade it back to 0% $(this).mouseleave(function(){ removeX.fadeTo("fast",0); }); }); }); If you didn't see it, here is the "X" I am trying to fade... <!-- Here is my Remove-X... --> <a class="remove-x" href='/cart//7806887'> <img src="/images/misc/remove-x.png"> </a> Thanks for the help in advance. You guys always rock my world on here. I need ya (can't go home til this is live... :(

    Read the article

  • ASP.NET make a panel visible on click of hyperlink (whilst also cuasing postback for page navigation

    - by Helen
    I may be asking the impossible but let me set out my problem: I have a menu in a MasterPage which uses images and mouseover mouseout events for design purposes. On one of the menu options I need to display a set of sub menus options on the click of the parent menu item. The menu item itself also needs to navigate to a specified url. I was originally trying to use an AJAX accordion panel but as I only had one accordion panel it was always displaying the sub menu items and was not collapsing. I have also tried putting the options in a div and setting the display via javascript. This worked but then was overwritten once the page navigation postback occurred. Here is the source: <%@ Master Language="VB" CodeFile="MasterPage.master.vb" Inherits="MasterPage" %> <%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <%@ Register Src="LeadHeader.ascx" TagName="LeadHeader" TagPrefix="uc1" %> <%@ Register Src="~/LeadFooter.ascx" TagName="LeadFooter" TagPrefix="uc2" %> <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <link href="StyleSheet.css" rel="stylesheet" type="text/css" /> <script type="text/javascript"> var revert = new Array(); var inames = new Array('home', 'whoweare', 'whatwedo','ourapproach', 'ourvalues', 'contact'); // Preload if (document.images) { var flipped = new Array(); for(i=0; i< inames.length; i++) { flipped[i] = new Image(); flipped[i].src = "images/"+inames[i]+"2.jpg"; } } function over(num) { if(document.images) { revert[num] = document.images[inames[num]].src; document.images[inames[num]].src = flipped[num].src; } } function out(num) { if(document.images) document.images[inames[num]].src = revert[num]; } function ShowHide(elementId) { var element = document.getElementById(elementId); if(element.style.display != "block") { element.style.display = "block"; } else { element.style.display = "none"; } } function UpdateText(element) { if(element.innerHTML.indexOf("Show") != -1) { element.innerHTML = "Hide Details"; } else { element.innerHTML = "Show Details"; } } </script> </head> <body> <form id="form1" runat="server"> <div> <asp:ContentPlaceHolder ID="ContentPlaceHolder2" runat="server"> <uc1:LeadHeader ID="LeadHeader" runat="server" /> </asp:ContentPlaceHolder> <div id="nav"> <div class="menu-item"> <a href="Default.aspx"> <img src="Images/home.jpg" alt="home" id="home" onmouseover="over(0)" onmouseout="out(0)" class="right" /></a> </div> <div class="menu-item"> <a href="AboutUs.aspx"> <img src="Images/whoweare.jpg" alt="who we are" id="whoweare" onmouseover="over(1)" onmouseout="out(1)" class="right" /></a> </div> <%-- <asp:ScriptManager ID="ScriptManager1" runat="server"> </asp:ScriptManager> <cc1:Accordion ID="Accordion1" runat="server" AutoSize="None" FadeTransitions="true" TransitionDuration="350" FramesPerSecond="40" RequireOpenedPane="false" > <Panes> <cc1:AccordionPane runat="server"> <Header>--%> <div class="menu-item"> <a href="WhatWeDo.aspx"> <img src="Images/whatwedo.jpg" alt="what we do" id="whatwedo" onmouseover="over(2)" onmouseout="out(2)" class="right" onclick="ShowHide('divDetails');UpdateText(this);" /></a></div> <%--/Header> <Content>--%> <div id="divDetails" style="display:none;"> <a href="management.aspx" title="Management Development">Management Development</a><br /> <a href="leadership.aspx" title="Leadership Development">Leadership Development</a><br /> <a href="personal.aspx" title="Personal Development">Personal Development</a><br /> <a href="realteams.aspx" title="Team Building / Facilitation">Team Building & Facilitation</a><br /> <a href="coaching.aspx" title="Coaching">One to One Coaching</a> </div> <%-- </Content> </cc1:AccordionPane> </Panes> </cc1:Accordion> --%> <div class="menu-item"> <a href="OurApproach.aspx"> <img src="images/ourapproach.jpg" alt="our approach" id="ourapproach" onmouseover="over(3)" onmouseout="out(3)" /></a> </div> <div class="menu-item"> <a href="OurValues.aspx"> <img src="images/ourvalues.jpg" alt="our values" id="ourvalues" onmouseover="over(4)" onmouseout="out(4)" /></a> </div> <div class="menu-item"> <a href="ContactUs.aspx"> <img src="images/ContactUs.jpg" alt="contact us" id="contactus" onmouseover="over(5)" onmouseout="out(5)" /></a> </div> </div> <asp:ContentPlaceHolder ID="ContentPlaceHolder1" runat="server"> </asp:ContentPlaceHolder> <asp:ContentPlaceHolder ID="ContentPlaceHolder3" runat="server"> <uc2:LeadFooter ID="LeadFooter" runat="server" /> </asp:ContentPlaceHolder> </div> </form> </body> </html>

    Read the article

  • vertical accordion from horizontal

    - by Sify Juhy
    //# jQuery - Horizontal Accordion //# Version 2.00.00 Alpha 1 //# //# portalZINE(R) - New Media Network //# http://www.portalzine.de //# //# Alexander Graef //# [email protected] //# //# Copyright 2007-2009 (function($) { $.hrzAccordion = { setOnEvent: function(i, container, finalWidth, settings){ $("#"+container+"Handle"+i).bind(settings.eventTrigger,function() { var status = $('[rel='+container+'ContainerSelected]').data('status'); if(status ==1 && settings.eventWaitForAnim === true){ return false; } if( $("#"+container+"Handle"+i).attr("rel") != container+"HandleSelected"){ settings.eventAction; $('[id*='+container+'Handle]').attr("rel",""); $('[id*='+container+'Handle]').attr("class",settings.handleClass); $("#"+container+"Handle"+i).addClass(settings.handleClassSelected); $("."+settings.contentWrapper).css({width: finalWidth+"px" }); switch(settings.closeOpenAnimation) { case 1: if($('[rel='+container+'ContainerSelected]').get(0) ){ $('[rel='+container+'ContainerSelected]').data('status',1); //current_width = $('[rel='+container+'ContainerSelected]').width(); $('[rel='+container+'ContainerSelected]').animate({width: "0px",opacity:"0"}, { queue:true, duration:settings.closeSpeed ,easing:settings.closeEaseAction,complete: function(){ $('[rel='+container+'ContainerSelected]').data('status',0); } ,step: function(now){ width = $(this).width(); //new_width = finalWidth- (finalWidth * (width/current_width)); new_width = finalWidth - width; $('#'+container+'Content'+i).width(Math.ceil(new_width)).css("opacity","1"); }}); }else{ $('[rel='+container+'ContainerSelected]').data('status',1); $('#'+container+'Content'+i).animate({width: finalWidth,opacity:"1"}, { queue:false, duration:settings.closeSpeed ,easing:settings.closeEaseAction,complete: function(){ $('[rel='+container+'ContainerSelected]').data('status',0); }}); } break; case 2: $('[id*='+container+'Content]').css({width: "0px"}); $('#'+container+'Content'+i).animate({width: finalWidth+"px",opacity:"1"}, { queue:false, duration:settings.openSpeed ,easing:settings.openEaseAction, complete: settings.completeAction }); break; } $('[id*='+container+'Content]').attr("rel",""); $("#"+container+"Handle"+i).attr("rel",container+"HandleSelected"); $("#"+container+"Content"+i).attr("rel",container+"ContainerSelected"); } }); } }; $.fn.extend({ hrzAccordionLoop: function(options) { return this.each(function(a){ var container = $(this).attr("id") || $(this).attr("class"); var elementCount = $('#'+container+' > li, .'+container+' > li').size(); var settings = $(this).data('settings'); variable_holder="interval"+container ; var i =0; var loopStatus = "start"; variable_holder = window.setInterval(function(){ $("#"+container+"Handle"+i).trigger(settings.eventTrigger); if(loopStatus =="start"){ i = i + 1; }else{ i = i-1; } if(i==elementCount && loopStatus == "start"){ loopStatus = "end"; i=elementCount-1; } if(i==0 && loopStatus == "end"){ loopStatus = "start"; i=0; } },settings.cycleInterval); }); }, hrzAccordion: function(options) { this.settings = { eventTrigger : "click", containerClass : "container", listItemClass : "listItem", contentContainerClass : "contentContainer", contentWrapper : "contentWrapper", contentInnerWrapper : "contentInnerWrapper", handleClass : "handle", handleClassOver : "handleOver", handleClassSelected : "handleSelected", handlePosition : "right", handlePositionArray : "", // left,left,right,right,right closeEaseAction : "swing", closeSpeed : 500, openEaseAction : "swing", openSpeed : 500, openOnLoad : 2, hashPrefix : "tab", eventAction : function(){ //add your own extra clickAction function here }, completeAction : function(){ //add your own onComplete function here }, closeOpenAnimation : 1,// 1 - open and close at the same time / 2- close all and than open next cycle : false, // not integrated yet, will allow to cycle through tabs by interval cycleInterval : 10000, fixedWidth : "", eventWaitForAnim : true }; if(options){ $.extend(this.settings, options); } var settings = this.settings; return this.each(function(a){ var container = $(this).attr("id") || $(this).attr("class"); $(this).data('settings', settings); $(this).wrap("<div class='"+settings.containerClass+"'></div>"); var elementCount = $('#'+container+' > li, .'+container+' > li').size(); var containerWidth = $("."+settings.containerClass).width(); var handleWidth = $("."+settings.handleClass).css("width"); handleWidth = handleWidth.replace(/px/,""); var finalWidth; var handle; if(settings.fixedWidth){ finalWidth = settings.fixedWidth; }else{ finalWidth = containerWidth-(elementCount*handleWidth)-handleWidth; } $('#'+container+' > li, .'+container+' > li').each(function(i) { $(this).attr('id', container+"ListItem"+i); $(this).attr('class',settings.listItemClass); $(this).html("<div class='"+settings.contentContainerClass+"' id='"+container+"Content"+i+"'>" +"<div class=\""+settings.contentWrapper+"\">" +"<div class=\""+settings.contentInnerWrapper+"\">" +$(this).html() +"</div></div></div>"); if($("div",this).hasClass(settings.handleClass)){ var html = $("div."+settings.handleClass,this).attr("id",""+container+"Handle"+i+"").html(); $("div."+settings.handleClass,this).remove(); handle = "<div class=\""+settings.handleClass+"\" id='"+container+"Handle"+i+"'>"+html+"</div>"; }else{ handle = "<div class=\""+settings.handleClass+"\" id='"+container+"Handle"+i+"'></div>"; } if(settings.handlePositionArray){ splitthis = settings.handlePositionArray.split(","); settings.handlePosition = splitthis[i]; } switch(settings.handlePosition ){ case "left": $(this).prepend( handle ); break; case "right": $(this).append( handle ); break; case "top": $("."+container+"Top").append( handle ); break; case "bottom": $("."+container+"Bottom").append( handle ); break; } $("#"+container+"Handle"+i).bind("mouseover", function(){ $("#"+container+"Handle"+i).addClass(settings.handleClassOver); }); $("#"+container+"Handle"+i).bind("mouseout", function(){ if( $("#"+container+"Handle"+i).attr("rel") != "selected"){ $("#"+container+"Handle"+i).removeClass(settings.handleClassOver); } }); $.hrzAccordion.setOnEvent(i, container, finalWidth, settings); if(i == elementCount-1){ $('#'+container+",."+container).show(); } if(settings.openOnLoad !== false && i == elementCount-1){ var location_hash = location.hash; location_hash = location_hash.replace("#", ""); if(location_hash.search(settings.hashPrefix) != '-1' ){ var tab = 1; location_hash = location_hash.replace(settings.hashPrefix, ""); } if(location_hash && tab ==1){ $("#"+container+"Handle"+(location_hash)).attr("rel",container+"HandleSelected"); $("#"+container+"Content"+(location_hash)).attr("rel",container+"ContainerSelected"); $("#"+container+"Handle"+(location_hash-1)).trigger(settings.eventTrigger); }else{ $("#"+container+"Handle"+(settings.openOnLoad)).attr("rel",container+"HandleSelected"); $("#"+container+"Content"+(settings.openOnLoad)).attr("rel",container+"ContainerSelected"); $("#"+container+"Handle"+(settings.openOnLoad-1)).trigger(settings.eventTrigger); } } }); if(settings.cycle === true){ $(this).hrzAccordionLoop(); } }); } }); })(jQuery); **Given is the code used for the accordion...please check out this Accordion Link. in the link there are four examples of accordions. i want the last accordion i.e example 4 to be vertical ...kindly help me.

    Read the article

  • Creating a grid overlay over image.

    - by neteus
    Hi everybody, I made a script (using mootools library) that is supposed to overlay an image with a table grid and when each grid cell is clicked/dragged over its background color changes 'highlighting' the cell. Current code creates a table and positions it over the element (el, image in this case). Table was used since I am planning to add rectangle select tool later on, and it seemed easiest way to do it. <html> <head> <title></title> <script type="text/javascript" src="mootools.js"></script> <script type="text/javascript"> var SetGrid = function(el, sz, nr, nc){ //get number of rows/columns according to the 'grid' size numcols = el.getSize().x/sz; numrows = el.getSize().y/sz; //create table element for injecting cols/rows var gridTable = new Element('table', { 'id' : 'gridTable', 'styles' : { 'width' : el.getSize().x, 'height' : el.getSize().y, 'top' : el.getCoordinates().top, 'left' : el.getCoordinates().left } }); //inject rows/cols into gridTable for (row = 1; row<=numrows; row++){ thisRow = new Element('tr', { 'id' : row, 'class' : 'gridRow' }); for(col = 1; col<=numcols; col++){ thisCol = new Element('td', { 'id' : col, 'class' : 'gridCol0' }); //each cell gets down/up over event... down starts dragging|up stops|over draws area if down was fired thisCol.addEvents({ 'mousedown' : function(){ dragFlag = true; startRow = this.getParent().get('id'); startCol = this.get('id'); }, 'mouseup' : function(){ dragFlag = false; }, 'mouseover' : function(){ if (dragFlag==true){ this.set('class', 'gridCol'+$$('#lvlSelect .on').get('value')); } }, 'click' : function(){ //this.set('class', 'gridCol'+$$('#lvlSelect .on').get('id').substr(3, 1) ); str = $$('#lvlSelect .on').get('id'); alert(str.substr(2, 3)); } }); thisCol.inject(thisRow, 'bottom'); }; thisRow.inject(gridTable, 'bottom'); }; gridTable.inject(el.getParent()); } //sens level selector func var SetSensitivitySelector = function(el, sz, nr, nc){ $$('#lvlSelect ul li').each(function(el){ el.addEvents({ 'click' : function(){ $$('#lvlSelect ul li').set('class', ''); this.set('class', 'on'); }, 'mouseover' : function(){ el.setStyle('cursor','pointer'); }, 'mouseout' : function(){ el.setStyle('cursor',''); } }); }); } //execute window.addEvent('load', function(){ SetGrid($('imagetomap'), 32); SetSensitivitySelector(); }); </script> <style> #imagetomapdiv { float:left; display: block; } #gridTable { border:1px solid red; border-collapse:collapse; position:absolute; z-index:5; } #gridTable td { opacity:0.2; filter:alpha(opacity=20); } #gridTable .gridCol0 { border:1px solid gray; background-color: none; } #gridTable .gridCol1 { border:1px solid gray; background-color: green; } #gridTable .gridCol2 { border:1px solid gray; background-color: blue; } #gridTable .gridCol3 { border:1px solid gray; background-color: yellow; } #gridTable .gridCol4 { border:1px solid gray; background-color: orange; } #gridTable .gridCol5 { border:1px solid gray; background-color: red; } #lvlSelect ul {float: left; display:block; position:relative; margin-left: 20px; padding: 10px; } #lvlSelect ul li { width:40px; text-align:center; display:block; border:1px solid black; position:relative; padding: 10px; list-style:none; opacity:0.2; filter:alpha(opacity=20); } #lvlSelect ul li.on { opacity:1; filter:alpha(opacity=100); } #lvlSelect ul #li0 { background-color: none; } #lvlSelect ul #li1 { background-color: green; } #lvlSelect ul #li2 { background-color: blue; } #lvlSelect ul #li3 { background-color: yellow; } #lvlSelect ul #li4 { background-color: orange; } #lvlSelect ul #li5 { background-color: red; } </style> </head> <body> <div id="imagetomapdiv"> <img id="imagetomap" src="1.png"> </div> <div id="lvlSelect"> <ul> <li value="0" id="li0">0</li> <li value="1" id="li1">1</li> <li value="2" id="li2">2</li> <li value="3" id="li3">3</li> <li value="4" id="li4">4</li> <li value="5" id="li5" class="on">5</li> </ul> </div> </body> </html> A 'working' example: http://72.14.186.218/~alex/motion.php There are two problems: while it works just fine in FF, IE and Chrome do not create the table if the page is refreshed. If you go back to directory root and click on the link to the file the grid table is displayed, if you hit 'refresh' button -- the script runs but the table is not injected. Secondly, although the table HTML is injected in IE, it does not display it. I tried adding nbsp's to make sure its not ignored -- to no avail. Any suggestions on improving code or help with the issues is appreciated. Thanks!

    Read the article

  • Grid overlayed on image using javascript, need help getting grid coordinates.

    - by Alos
    Hi I am fairly new to javascript and could use some help, I am trying to overlay a grid on top of an image and then be able to have the user click on the grid and get the grid coordinate from the box that the user clicked. I have been working with the code from the following stackoverflow question: Creating a grid overlay over image. link text Here is the code that I have so far: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> </script> <script type="text/javascript"> var SetGrid = function(el, sz, nr, nc){ //get number of rows/columns according to the 'grid' size //numcols = el.getSize().x/sz; //numrows = el.getSize().y/sz; numcols = 48; numrows = 32; //create table element for injecting cols/rows var gridTable = new Element('table', { 'id' : 'gridTable', 'styles' : { 'width' : el.getSize().x, 'height' : el.getSize().y, 'top' : el.getCoordinates().top, 'left' : el.getCoordinates().left } }); //inject rows/cols into gridTable for (row = 1; row<=numrows; row++){ thisRow = new Element('tr', { 'id' : row, 'class' : 'gridRow' }); for(col = 1; col<=numcols; col++){ thisCol = new Element('td', { 'id' : col, 'class' : 'gridCol0' }); //each cell gets down/up over event... down starts dragging|up stops|over draws area if down was fired thisCol.addEvents({ 'mousedown' : function(){ dragFlag = true; startRow = this.getParent().get('id'); startCol = this.get('id'); }, 'mouseup' : function(){ dragFlag = false; }, 'mouseover' : function(){ if (dragFlag==true){ this.set('class', 'gridCol'+$$('#lvlSelect .on').get('value')); } }, 'click' : function(){ //this.set('class', 'gridCol'+$$('#lvlSelect .on').get('id').substr(3, 1) ); str = $$('#lvlSelect .on').get('id'); alert(str.substr(2, 3)); } }); thisCol.inject(thisRow, 'bottom'); }; thisRow.inject(gridTable, 'bottom'); }; gridTable.inject(el.getParent()); } //sens level selector func var SetSensitivitySelector = function(el, sz, nr, nc){ $$('#lvlSelect ul li').each(function(el){ el.addEvents({ 'click' : function(){ $$('#lvlSelect ul li').set('class', ''); this.set('class', 'on'); }, 'mouseover' : function(){ el.setStyle('cursor','pointer'); }, 'mouseout' : function(){ el.setStyle('cursor',''); } }); }); } //execute window.addEvent('load', function(){ SetGrid($('imagetomap'), 32); SetSensitivitySelector(); }); var gridSize = { x: 48, y: 32 }; var img = document.getElementById('imagetomap'); img.onclick = function(e) { if (!e) e = window.event; alert(Math.floor(e.offsetX/ gridSize.x) + ', ' + Math.floor(e.offsetY / gridSize.y)); } </script> <style> #imagetomapdiv { float:left; display: block; } #gridTable { border:1px solid red; border-collapse:collapse; position:absolute; z-index:5; } #gridTable td { opacity:0.2; filter:alpha(opacity=20); } #gridTable .gridCol0 { border:1px solid gray; background-color: none; } #gridTable .gridCol1 { border:1px solid gray; background-color: green; } #gridTable .gridCol2 { border:1px solid gray; background-color: blue; } #gridTable .gridCol3 { border:1px solid gray; background-color: yellow; } #gridTable .gridCol4 { border:1px solid gray; background-color: orange; } #gridTable .gridCol5 { border:1px solid gray; background-color: red; } #lvlSelect ul {float: left; display:block; position:relative; margin-left: 20px; padding: 10px; } #lvlSelect ul li { width:40px; text-align:center; display:block; border:1px solid black; position:relative; padding: 10px; list-style:none; opacity:0.2; filter:alpha(opacity=20); } #lvlSelect ul li.on { opacity:1; filter:alpha(opacity=100); } #lvlSelect ul #li0 { background-color: none; } #lvlSelect ul #li1 { background-color: green; } #lvlSelect ul #li2 { background-color: blue; } #lvlSelect ul #li3 { background-color: yellow; } #lvlSelect ul #li4 { background-color: orange; } #lvlSelect ul #li5 { background-color: red; } </style> </div> <div id="lvlSelect"> <ul> <li value="0" id="li0">0</li> <li value="1" id="li1">1</li> <li value="2" id="li2">2</li> <li value="3" id="li3">3</li> <li value="4" id="li4">4</li> <li value="5" id="li5" class="on">5</li> </ul> </div> In this example the grid box changes color when the image is grid box is clicked, but I would like to be able to have the coordinates of the box. Any help would be great. Thank you

    Read the article

< Previous Page | 3 4 5 6 7 8  | Next Page >