Search Results

Search found 2172 results on 87 pages for 'ul'.

Page 8/87 | < Previous Page | 4 5 6 7 8 9 10 11 12 13 14 15  | Next Page >

  • How to develop a Jquery plugin to find the first child that match with a selector?

    - by Ivan
    I'm trying to make a Jquery plugin (findFirst()) to find the first child with a given characteristics (something in the middle of the find() and children() functions. For instance, given this markup: <div id="start"> <div> <span>Hello world</span> <ul class="valid-result"> ... </ul> <ul class="valid-result"> <li> <ul class="not-a-result"> ... </ul> </li> </ul> <div> <ul class="valid-result"> ... </ul> </div> </div> </div> If you ask for $("#start").findFirst('ul') it should return all ul lists that I have tagged with the valid-result class, but not the ul with class not-a-result. It is, this function has to find the first elements that matches with a given selector, but not the inner elements that match this selector. This is the first time I try to code a Jquery function, and what I've already read doesn't helps me too much with this. The function I have developed is this: jQuery.fn.findFirst = function (sel) { return this.map(function() { return $(this).children().map(function() { if ($(this).is(sel)) { return $(this); } else { return $(this).findFirst(sel); } }); }); } It works in the sense it tries to return the expected result, but the format it returns the result is very rare for me. I suppose the problem is something I don't understand about Jquery. Here you have the JFiddle where I'm testing. EDIT The expected result after $("#start").findFirst('ul') is a set with all UL that have the class 'valid-result' BUT it's not possible to use this class because it doesn't exist in a real case (it's just to try to explain the result). This is not equivalent to first(), because first returns only one element!

    Read the article

  • ASP.NET List Control

    - by Ricardo Peres
    Today I developed a simple control for generating lists in ASP.NET, something that the base class library does not contain; it allows for nested lists where the list item types and images can be configured on a list by list basis. Since it was a great fun to develop, I'd like to share it here. Here is the code: [ParseChildren(true)] [PersistChildren(false)] public class List: WebControl { public List(): base("ul") { this.Items = new List(); this.ListStyleType = ListStyleType.Auto; this.ListStyleImageUrl = String.Empty; this.CommonCssClass = String.Empty; this.ContainerCssClass = String.Empty; } [DefaultValue(ListStyleType.Auto)] public ListStyleType ListStyleType { get; set; } [DefaultValue("")] [UrlProperty("*.png;*.gif;*.jpg")] public String ListStyleImageUrl { get; set; } [DefaultValue("")] [CssClassProperty] public String CommonCssClass { get; set; } [DefaultValue("")] [CssClassProperty] public String ContainerCssClass { get; set; } [Browsable(false)] [PersistenceModeAttribute(PersistenceMode.InnerProperty)] public List Items { private set; get; } protected override void Render(HtmlTextWriter writer) { String cssClass = String.Join(" ", new String [] { this.CssClass, this.ContainerCssClass }); if (cssClass.Trim().Length != 0) { this.CssClass = cssClass; } if (String.IsNullOrEmpty(this.ListStyleImageUrl) == false) { this.Style[ HtmlTextWriterStyle.ListStyleImage ] = String.Format("url('{0}')", this.ResolveClientUrl(this.ListStyleImageUrl)); } if (this.ListStyleType != ListStyleType.Auto) { switch (this.ListStyleType) { case ListStyleType.Circle: case ListStyleType.Decimal: case ListStyleType.Disc: case ListStyleType.None: case ListStyleType.Square: this.Style [ HtmlTextWriterStyle.ListStyleType ] = this.ListStyleType.ToString().ToLower(); break; case ListStyleType.LowerAlpha: this.Style [ HtmlTextWriterStyle.ListStyleType ] = "lower-alpha"; break; case ListStyleType.LowerRoman: this.Style [ HtmlTextWriterStyle.ListStyleType ] = "lower-roman"; break; case ListStyleType.UpperAlpha: this.Style [ HtmlTextWriterStyle.ListStyleType ] = "upper-alpha"; break; case ListStyleType.UpperRoman: this.Style [ HtmlTextWriterStyle.ListStyleType ] = "upper-roman"; break; } } base.Render(writer); } protected override void RenderChildren(HtmlTextWriter writer) { foreach (ListItem item in this.Items) { this.writeItem(item, this, 0); } base.RenderChildren(writer); } private void writeItem(ListItem item, Control control, Int32 depth) { HtmlGenericControl li = new HtmlGenericControl("li"); control.Controls.Add(li); if (String.IsNullOrEmpty(this.CommonCssClass) == false) { String cssClass = String.Join(" ", new String [] { this.CommonCssClass, this.CommonCssClass + depth }); li.Attributes [ "class" ] = cssClass; } foreach (String key in item.Attributes.Keys) { li.Attributes[key] = item.Attributes [ key ]; } li.InnerText = item.Text; if (item.ChildItems.Count != 0) { HtmlGenericControl ul = new HtmlGenericControl("ul"); li.Controls.Add(ul); if (String.IsNullOrEmpty(this.ContainerCssClass) == false) { ul.Attributes["class"] = this.ContainerCssClass; } if ((item.ListStyleType != ListStyleType.Auto) || (String.IsNullOrEmpty(item.ListStyleImageUrl) == false)) { if (String.IsNullOrEmpty(item.ListStyleImageUrl) == false) { ul.Style[HtmlTextWriterStyle.ListStyleImage] = String.Format("url('{0}');", this.ResolveClientUrl(item.ListStyleImageUrl)); } if (item.ListStyleType != ListStyleType.Auto) { switch (this.ListStyleType) { case ListStyleType.Circle: case ListStyleType.Decimal: case ListStyleType.Disc: case ListStyleType.None: case ListStyleType.Square: ul.Style[ HtmlTextWriterStyle.ListStyleType ] = item.ListStyleType.ToString().ToLower(); break; case ListStyleType.LowerAlpha: ul.Style [ HtmlTextWriterStyle.ListStyleType ] = "lower-alpha"; break; case ListStyleType.LowerRoman: ul.Style [ HtmlTextWriterStyle.ListStyleType ] = "lower-roman"; break; case ListStyleType.UpperAlpha: ul.Style [ HtmlTextWriterStyle.ListStyleType ] = "upper-alpha"; break; case ListStyleType.UpperRoman: ul.Style [ HtmlTextWriterStyle.ListStyleType ] = "upper-roman"; break; } } } foreach (ListItem childItem in item.ChildItems) { this.writeItem(childItem, ul, depth + 1); } } } } [Serializable] [ParseChildren(true, "ChildItems")] public class ListItem: IAttributeAccessor { public ListItem() { this.ChildItems = new List(); this.Attributes = new Dictionary(); this.Text = String.Empty; this.Value = String.Empty; this.ListStyleType = ListStyleType.Auto; this.ListStyleImageUrl = String.Empty; } [DefaultValue(ListStyleType.Auto)] public ListStyleType ListStyleType { get; set; } [DefaultValue("")] [UrlProperty("*.png;*.gif;*.jpg")] public String ListStyleImageUrl { get; set; } [DefaultValue("")] public String Text { get; set; } [DefaultValue("")] public String Value { get; set; } [Browsable(false)] public List ChildItems { get; private set; } [Browsable(false)] public Dictionary Attributes { get; private set; } String IAttributeAccessor.GetAttribute(String key) { return (this.Attributes [ key ]); } void IAttributeAccessor.SetAttribute(String key, String value) { this.Attributes [ key ] = value; } } [Serializable] public enum ListStyleType { Auto = 0, Disc, Circle, Square, Decimal, LowerRoman, UpperRoman, LowerAlpha, UpperAlpha, None } SyntaxHighlighter.config.clipboardSwf = 'http://alexgorbatchev.com/pub/sh/2.0.320/scripts/clipboard.swf'; SyntaxHighlighter.brushes.CSharp.aliases = ['c#', 'c-sharp', 'csharp']; SyntaxHighlighter.all();

    Read the article

  • How to properly position 3rd level menu [migrated]

    - by drewrowalnd
    If you look here: http://snippetmagazine.com/ under about isl-board of trustees you can se I have created a third level dropdown, but how can I properly align that drop down? Below you will see my css. #menudiv { width: 999px; float: left; clear: left; height: 250px; background: url(images/top_bg.png) no-repeat; margin-top: 10px; } mainmenu { width: 948px; height: 63px; float: left; margin-left: 16px; margin-top:5px; border: 1px solid #D5D5D5; -moz-border-radius: 3px; -webkit-border-radius: 3px; -webkit-box-shadow: 0px 1px 2px rgba(0, 0, 0, 0.1); -moz-box-shadow: 0px 1px 2px rgba(0, 0, 0, 0.1); background:url(images/nav_bg.gif) repeat; } .mainnav { margin: 0; padding: 0; list-style: none; } .mainnav * { margin: 0; padding: 0; list-style: none; } .mainnav ul { position: absolute; top: -999em; display: none; } .mainnav li { float: left; position: relative; z-index: 999; height: 63px; line-height: 55px; margin-right: 0px; border-right: 1px solid #D5D5D5; } .mainnav li.last { border-right: none; } .mainnav a { display: block; font-size: 19px; margin: 0; color: #cc9900; font-family: Copperplate, Arial, Helvetica, Sans serif; font-weight:600; text-decoration: none; padding: 3px 13px 3px 12px; color: #555; text-shadow: 0 1px 1px white; } .mainnav li:hover { text-decoration: none; border-bottom: solid 0px #ccc; background: white; } .mainnav ul li{ width: 132px; } .mainnav li:hover ul, ul.mainnav li.sfHover ul { left: 0px; top: 50px; padding-top: 0px; width: 132px; border-bottom: solid 0px #eaeaea; background: url(images/nav_dropdown_shadow.gif) repeat-x top; padding: 6px 0 0px 0px; margin: 13px 0 0 -1px; border: 1px solid #D5D5D5; -moz-border-radius-bottomleft: 3px; -webkit-border-bottom-left-radius: 3px; -moz-border-radius-bottomright: 3px; -webkit-border-bottom-right-radius: 3px; -webkit-box-shadow: 0px 1px 3px rgba(0, 0, 0, 0.1); -moz-box-shadow: 0px 1px 3px rgba(0, 0, 0, 0.1); width: 175px; border-bottom-left-radius: 3px 3px; border-bottom-right-radius: 3px 3px; } .mainnav li:hover li ul, .mainnav li.sfHover li ul { top: -999em; } .mainnav li li:hover ul, ul.mainnav li li.sfHover ul { left: 132px; top: -8px; } .mainnav li:hover ul, .mainnav li li:hover ul { top: -999em; } .mainnav li li { color: #555; display: block; padding: 0px; height: auto !important; border: none; width:175px; background: url(images/nav_dropdown_bg.gif) repeat; margin: 0; } .mainnav li li a:link, .mainnav li li a:visited { display: block; height: auto !important; line-height: 30px; color: #333; font-weight: normal; font-family: arial, helvetica, sans-serif; font-size: 12px; border: none; margin: 0; padding-left: 10px; overflow:hidden; border-bottom: 1px solid #E3E3E3; } .mainnav li li :hover{ } .mainnav li li a:hover { background: none; color:#555 ; border-bottom: 1px solid #E3E3E3; }

    Read the article

  • Cant center dropdown menu

    - by sonicboom
    I have a dropdown below ive creaeted, but im having troulbe centering the the menu. Ive tried to put <center> tags around it and also set the ul to margin auto 0 but its not working. Is there anything im missing? <style type="text/css"> ul { font-family: Arial, Verdana; font-size: 14px; margin: 0; padding: 0; list-style: none; } ul li { display: block; position: relative; float: left; } li ul { display: none; } ul li a { display: block; text-decoration: none; color: #ffffff; border-top: 1px solid #ffffff; padding: 5px 15px 5px 15px; background: #1e7c9a; margin-left: 1px; white-space: nowrap; } ul li a:hover { background: #3b3b3b; } li:hover ul { display: block; position: absolute; } li:hover li { float: none; font-size: 11px; } li:hover a { background: #3b3b3b; } li:hover li a:hover { background: #1e7c9a; } </style> </head> <body> <ul id="menu"> <li><a href="#">Home</a></li> <li><a href="#">Portfolio</a> <ul> <li><a href="#">Web Design</a></li> <li><a href="#">Graphic Design</a></li> <li><a href="#">Logo Design</a></li> <li><a href="#">Blog Design</a></li> </ul> </li> <li><a href="#">Projects</a> <ul> <li><a href="#">This is a project</a></li> <li><a href="#">So is this</a></li> <li><a href="#">and this</a></li> <li><a href="#">don't forget this too</a></li> </ul> </li> <li><a href="#">Contact</a> <ul> <li><a href="#">Support</a></li> <li><a href="#">Quote</a></li> <li><a href="#">General Enquiry</a></li> </ul> </li> </ul> I went ahead and put it on jsfiddle Here

    Read the article

  • CSS Dropdown Menu issues

    - by Simon Hume
    Can anyone help with a small problem. I've got a nice simple CSS dropdown menu http://www.cinderellahair.co.uk/new/CSSDropdown.html The problem I have is when you rollover a menu item that has children which are wider than the content, it pushes the whole menu right. Aside of shortening the child menu links down, is there any tweak I can make to my CSS to stop this happening? CSS Code: /* General */ #cssdropdown, #cssdropdown ul { list-style: none; } #cssdropdown, #cssdropdown * { padding: 0; margin: 0; } #cssdropdown {padding:43px 0px 0px 0px;} /* Head links */ #cssdropdown li.headlink { margin:0px 40px 0px -1px; float: left; background-color: #e9e9e9;} #cssdropdown li.headlink a { display: block; padding: 0px 0px 0px 5px; text-decoration:none; } #cssdropdown li.headlink a:hover { text-decoration:underline; } /* Child lists and links */ #cssdropdown li.headlink ul { display: none; text-align: left; padding:10px 0px 0px 0px; font-size:12px; float:left;} #cssdropdown li.headlink:hover ul { display: block; } #cssdropdown li.headlink ul li a { padding: 5px; height: 17px; } #cssdropdown li.headlink ul li a:hover { background-color: #333; } /* Pretty styling */ body { font-family:Georgia, "Times New Roman", Times, serif; font-size: 16px; } #cssdropdown a { color: grey; } #cssdropdown ul li a:hover { text-decoration: none; } #cssdropdown li.headlink { background-color: white; } #cssdropdown li.headlink ul { padding-bottom: 10px;} HTML: <ul id="cssdropdown"> <li class="headlink"><a href="http://www.cinderellahair.co.uk/new/index.php">HOME</a></li> <li class="headlink"><a href="http://www.cinderellahair.co.uk/new/gallery/gallery.php">GALLERY</a> <ul> <li><a href="http://amazon.com/">CELEBRITY</a></li> <li><a href="http://ebay.com/">BEFORE &amp; AFTER</a></li> <li><a href="http://craigslist.com/">HAIR TYPES</a></li> </ul> </li> <li class="headlink"><a href="http://www.cinderellahair.co.uk/new/about-cinderella-hair-extensions/about-us.php">ABOUT US</a> <ul> <li><a href="http://amazon.com/">WHY CHOOSE CINDERELLA</a></li> <li><a href="http://ebay.com/">TESTIMONIALS</a></li> <li><a href="http://craigslist.com/">MINI VIDEO CLIPS</a></li> <li><a href="http://craigslist.com/">OUR HAIR PRODUCTS</a></li> </ul> </li> <li class="headlink"><a href="http://www.cinderellahair.co.uk/new/news-and-offers/news.php">NEWS &amp; OFFERS</a> <ul> <li><a href="http://amazon.com/">VERA WANG FREE GIVEAWAY</a></li> <li><a href="http://ebay.com/">CINDERELLA ON TV</a></li> <li><a href="http://craigslist.com/">CINDERELLA IN THE PRESS</a></li> <li><a href="http://craigslist.com/">CINDRELLA NEWSLETTERS</a></li> </ul> </li> <li class="headlink"><a href="http://www.cinderellahair.co.uk/new/cinderella-salon/salon-finder.php">SALON FINDER</a></li> </ul> JS Code: $(document).ready(function(){ $('#cssdropdown li.headlink').hover( function() { $('ul', this).css('display', 'block'); }, function() { $('ul', this).css('display', 'none'); }); }); Full code is on the link above, just view source.

    Read the article

  • How to loop through LI items in UL, get specific attributes, and pass them via $.ajax data

    - by Ahmed Fouad
    Here is my HTML code: <ul id="gallery"> <li id="attachment-32" class="featured"><a href="..." title=""><img src="..." alt="" /></a></li> <li id="attachment-34"><a href="..." title=""><img src="..." alt="" /></a></li> <li id="attachment-38"><a href="..." title=""><img src="..." alt="" /></a></li> <li id="attachment-64"><a href="..." title=""><img src="..." alt="" /></a></li> <li id="attachment-75"><a href="..." title=""><img src="..." alt="" /></a></li> <li></li> </ul> Here is my sample ajax request: $.ajax({ url: '/ajax/upload.php', type: 'POST', data: { ... }, success: function(data){ } }); Here is what I want to achieve. How to get the attachment number in ID attribute for every LI inside the gallery UL only when an ID attr is there and pass them via ajax data in this way: { attached : '32,34,38,64,75' } if there is a better way of doing this let me know I want to pass the list items which contain attachments to process. How to get the list item LI which has class of featured e.g. { featured_img : .. } and pass the attachment ID number if featured LI exists, and if none of list items is featured pass featured_img with 0. So i know how to process it via php in the request. Any help is appreciated. Thank you.

    Read the article

  • content show problem

    - by nonab
    I still fight with some jquery scripts:) With my first problem Jens Fahnenbruck helped me here: http://stackoverflow.com/questions/3021476/problem-with-hide-show-in-jquery thanks:) Now i added another fancy thing - jquery tabs Made a few modifications and it works like this: When you click on tab and it loads different main image for every tab. The problem is that i used $(document).ready(function() to handle those image changes. When i click any of 2x2 box images (on any tab) it will permanently change the image on the right and when i click on tabs it won't work like it did at the beginning. online example: http://rarelips.ayz.pl/testy/2/ code: <style type="text/css"> body { font: Arial, Helvetica, sans-serif normal 10px; margin: 0; padding: 0; } * {margin: 0; padding: 0;} img {border: none;} .container { height: 500px; width: 1000px; margin: -180px 0 0 -450px; top: 50%; left: 50%; position: absolute; } ul.thumb { float: left; list-style: none; margin: 0; padding: 10px; width: 360px; } ul.thumb li { margin: 0; padding: 5px; float: left; position: relative; width: 165px; height: 165px; } ul.thumb li img { width: 150px; height: 150px; border: 1px solid #ddd; padding: 10px; background: #f0f0f0; position: absolute; left: 0; top: 0; -ms-interpolation-mode: bicubic; } ul.thumb li img.hover { background:url(thumb_bg.png) no-repeat center center; border: none; } #main_view { float: left; padding: 9px 0; margin-left: -10px; } #main_view2 { float: left; padding: 9px 0; margin-left: -10px; } #main_view3 { float: left; padding: 9px 0; margin-left: -10px; } #main_view4 { float: left; padding: 9px 0; margin-left: -10px; } #wiecej { float: right; padding: 9px 0; margin-right: 20px; } .demo-show { width: 350px; margin: 1em .5em; } .demo-show h3 { margin: 0; padding: .25em; background: #bfcd93; border-top: 1px solid #386785; border-bottom: 1px solid #386785; } .demo-show div { padding: .5em .25em; } /* styl do tabek */ ul.tabs { margin: 0; padding: 0; float: left; list-style: none; height: 32px; /*--Set height of tabs--*/ border-bottom: 1px solid #999; border-left: 1px solid #999; width: 100%; } ul.tabs li { float: left; margin: 0; padding: 0; height: 31px; /*--Subtract 1px from the height of the unordered list--*/ line-height: 31px; /*--Vertically aligns the text within the tab--*/ border: 1px solid #999; border-left: none; margin-bottom: -1px; /*--Pull the list item down 1px--*/ overflow: hidden; position: relative; background: #e0e0e0; } ul.tabs li a { text-decoration: none; color: #000; display: block; font-size: 1.2em; padding: 0 20px; border: 1px solid #fff; /*--Gives the bevel look with a 1px white border inside the list item--*/ outline: none; } ul.tabs li a:hover { background: #ccc; } html ul.tabs li.active, html ul.tabs li.active a:hover { /*--Makes sure that the active tab does not listen to the hover properties--*/ background: #fff; border-bottom: 1px solid #fff; /*--Makes the active tab look like it's connected with its content--*/ } .tab_container { border: 1px solid #999; border-top: none; overflow: hidden; clear: both; float: left; width: 100%; background: #fff; } .tab_content { padding: 20px; font-size: 1.2em; } </style> <script type="text/javascript" src="index_pliki/jquery-latest.js"></script> <script type="text/javascript"> $(document).ready(function(){ //Larger thumbnail preview $("ul.thumb li").hover(function() { $(this).css({'z-index' : '10'}); $(this).find('img').addClass("hover").stop() .animate({ marginTop: '-110px', marginLeft: '-110px', top: '50%', left: '50%', width: '200px', height: '200px', padding: '5px' }, 200); } , function() { $(this).css({'z-index' : '0'}); $(this).find('img').removeClass("hover").stop() .animate({ marginTop: '0', marginLeft: '0', top: '0', left: '0', width: '150px', height: '150px', padding: '10px' }, 400); }); //Swap Image on Click $("ul.thumb li a").click(function() { var mainImage = $(this).attr("href"); //Find Image Name $("#main_view img").attr({ src: mainImage }); $("#main_view2 img").attr({ src: mainImage }); $("#main_view3 img").attr({ src: mainImage }); $("#main_view4 img").attr({ src: mainImage }); return false; }); }); </script> <script type="text/javascript"> $(document).ready(function() { $("#main_view img").attr({ src: './index_pliki/max1.jpg' }); $("#slickbox div[data-id=" + '01' + "].slickbox").show('slow'); $('a.slick-toggle').click(function() { var dataID = $(this).attr("data-id"); $('#slickbox div.slickbox').hide(); $("#slickbox div[data-id=" + dataID + "].slickbox").show('slow'); return false; }); }); </script> <script type="text/javascript"> $(document).ready(function() { $("#main_view2 img").attr({ src: './index_pliki/max2.jpg' }); $("#slickbox2 div[data-id=" + '11' + "].slickbox2").show('slow'); $('a.slick-toggle').click(function() { var dataID = $(this).attr("data-id"); $('#slickbox2 div.slickbox2').hide(); $("#slickbox2 div[data-id=" + dataID + "].slickbox2").show('slow'); return false; }); }); </script> <script type="text/javascript"> $(document).ready(function() { $("#main_view3 img").attr({ src: './index_pliki/max3.jpg' }); $("#slickbox3 div[data-id=" + '21' + "].slickbox3").show('slow'); $('a.slick-toggle').click(function() { var dataID = $(this).attr("data-id"); $('#slickbox3 div.slickbox3').hide(); $("#slickbox3 div[data-id=" + dataID + "].slickbox3").show('slow'); return false; }); }); </script> <script type="text/javascript"> $(document).ready(function() { $("#main_view4 img").attr({ src: './index_pliki/max4.jpg' }); $("#slickbox4 div[data-id=" + '31' + "].slickbox4").show('slow'); $('a.slick-toggle').click(function() { var dataID = $(this).attr("data-id"); $('#slickbox4 div.slickbox4').hide(); $("#slickbox4 div[data-id=" + dataID + "].slickbox4").show('slow'); return false; }); }); </script> <script type ="text/javascript"> $(document).ready(function() { //When page loads... $(".tab_content").hide(); //Hide all content $("ul.tabs li:first").addClass("active").show(); //Activate first tab $(".tab_content:first").show(); //Show first tab content //On Click Event $("ul.tabs li").click(function() { $("ul.tabs li").removeClass("active"); //Remove any "active" class $(this).addClass("active"); //Add "active" class to selected tab $(".tab_content").hide(); //Hide all tab content var activeTab = $(this).find("a").attr("href"); //Find the href attribute value to identify the active tab + content $(activeTab).fadeIn(); //Fade in the active ID content return false; }); }); </script> </head> <body> <div class="container"> <ul class="tabs"> <li><a href="#tab1">1</a></li> <li><a href="#tab2">2</a></li> <li><a href="#tab3">3</a></li> <li><a href="#tab4">4</a></li> </ul> <div class="tab_container"> <div id="tab1" class="tab_content"> <!--Content--> <ul class="thumb"> <li><a class="slick-toggle" href="./index_pliki/max1.jpg" data-id="01"><img src="./index_pliki/min1.jpg" alt="" /></a></li> <li><a class="slick-toggle" href="./index_pliki/max2.jpg" data-id="02"><img src="./index_pliki/min2.jpg" alt="" /></a></li> <li><a class="slick-toggle" href="./index_pliki/max3.jpg" data-id="03"><img src="./index_pliki/min3.jpg" alt="" /></a></li> <li><a class="slick-toggle" href="./index_pliki/max4.jpg" data-id="04"><img src="./index_pliki/min4.jpg" alt="" /></a></li> </ul> <div id="main_view"> <a href="index.htm"><img src="index_pliki/max1.jpg" alt=""/></a> <small style="float: right; color: rgb(153, 153, 153);"> </small> </div> <div id="wiecej"> <div id="slickbox"> <div id="someOtherID" class="slickbox" data-id="01" style="display: none;"> 1.1 </div> <div id="someOtherID" class="slickbox" data-id="02" style="display: none;"> 1.2 </div> <div id="someOtherID" class="slickbox" data-id="03" style="display: none;"> 1.3 </div> <div id="someOtherID" class="slickbox" data-id="04" style="display: none;"> 1.4 </div> <!-- <a href="#" id="slick-show"><img src="http://www.amptech.pl/images/more.jpg" alt="Zobacz wiecej" /></a> <a href="#" id="slick-hide"><img src="http://www.amptech.pl/images/online.jpg" alt="Zobacz wiecej" /></a>&nbsp;&nbsp; --> </div> </div> </div> <!-- tutaj wklejalem reszte --> <div id="tab2" class="tab_content"> <!--Content--> <ul class="thumb"> <li><a class="slick-toggle" href="./index_pliki/max4.jpg" data-id="11"><img src="./index_pliki/min4.jpg" alt="" /></a></li> <li><a class="slick-toggle" href="./index_pliki/max3.jpg" data-id="12"><img src="./index_pliki/min3.jpg" alt="" /></a></li> <li><a class="slick-toggle" href="./index_pliki/max2.jpg" data-id="13"><img src="./index_pliki/min2.jpg" alt="" /></a></li> <li><a class="slick-toggle" href="./index_pliki/max1.jpg" data-id="14"><img src="./index_pliki/min1.jpg" alt="" /></a></li> </ul> <div id="main_view2"> <a href="index.htm"><img src="index_pliki/max1.jpg" alt=""/></a> <small style="float: right; color: rgb(153, 153, 153);"> </small> </div> <div id="wiecej"> <div id="slickbox2"> <div id="someOtherID" class="slickbox2" data-id="11" style="display: none;"> 2.1 </div> <div id="someOtherID" class="slickbox2" data-id="12" style="display: none;"> 2.2 </div> <div id="someOtherID" class="slickbox2" data-id="13" style="display: none;"> 2.3 </div> <div id="someOtherID" class="slickbox2" data-id="14" style="display: none;"> 2.4 </div> </div> </div> </div> <div id="tab3" class="tab_content"> <ul class="thumb"> <li><a class="slick-toggle" href="./index_pliki/max4.jpg" data-id="21"><img src="./index_pliki/min4.jpg" alt="" /></a></li> <li><a class="slick-toggle" href="./index_pliki/max3.jpg" data-id="22"><img src="./index_pliki/min3.jpg" alt="" /></a></li> <li><a class="slick-toggle" href="./index_pliki/max2.jpg" data-id="23"><img src="./index_pliki/min2.jpg" alt="" /></a></li> <li><a class="slick-toggle" href="./index_pliki/max1.jpg" data-id="24"><img src="./index_pliki/min1.jpg" alt="" /></a></li> </ul> <div id="main_view3"> <a href="index.htm"><img src="index_pliki/max1.jpg" alt=""/></a> <small style="float: right; color: rgb(153, 153, 153);"> </small> </div> <div id="wiecej"> <div id="slickbox3"> <div id="someOtherID" class="slickbox3" data-id="21" style="display: none;"> 3.1 </div> <div id="someOtherID" class="slickbox3" data-id="22" style="display: none;"> 3.2 </div> <div id="someOtherID" class="slickbox3" data-id="23" style="display: none;"> 3.3 </div> <div id="someOtherID" class="slickbox3" data-id="24" style="display: none;"> 3.4 </div> </div> </div> </div> <div id="tab4" class="tab_content"> <ul class="thumb"> <li><a class="slick-toggle" href="./index_pliki/max4.jpg" data-id="31"><img src="./index_pliki/min4.jpg" alt="" /></a></li> <li><a class="slick-toggle" href="./index_pliki/max3.jpg" data-id="32"><img src="./index_pliki/min3.jpg" alt="" /></a></li> <li><a class="slick-toggle" href="./index_pliki/max2.jpg" data-id="33"><img src="./index_pliki/min2.jpg" alt="" /></a></li> <li><a class="slick-toggle" href="./index_pliki/max1.jpg" data-id="34"><img src="./index_pliki/min1.jpg" alt="" /></a></li> </ul> <div id="main_view4"> <a href="index.htm"><img src="index_pliki/max1.jpg" alt=""/></a> <small style="float: right; color: rgb(153, 153, 153);"> </small> </div> <div id="wiecej"> <div id="slickbox4"> <div id="someOtherID" class="slickbox4" data-id="31" style="display: none;"> 4.1 </div> <div id="someOtherID" class="slickbox4" data-id="32" style="display: none;"> 4.2 </div> <div id="someOtherID" class="slickbox4" data-id="33" style="display: none;"> 4.3 </div> <div id="someOtherID" class="slickbox4" data-id="34" style="display: none;"> 4.4 </div> </div> </div> </div> </div> </div>

    Read the article

  • Mobile Friendly Websites with CSS Media Queries

    - by dwahlin
    In a previous post the concept of CSS media queries was introduced and I discussed the fundamentals of how they can be used to target different screen sizes. I showed how they could be used to convert a 3-column wide page into a more vertical view of data that displays better on devices such as an iPhone:     In this post I'll provide an additional look at how CSS media queries can be used to mobile-enable a sample site called "Widget Masters" without having to change any server-side code or HTML code. The site that will be discussed is shown next:     This site has some of the standard items shown in most websites today including a title area, menu bar, and sections where data is displayed. Without including CSS media queries the site is readable but has to be zoomed out to see everything on a mobile device, cuts-off some of the menu items, and requires horizontal scrolling to get to additional content. The following image shows what the site looks like on an iPhone. While the site works on mobile devices it's definitely not optimized for mobile.     Let's take a look at how CSS media queries can be used to override existing styles in the site based on different screen widths. Adding CSS Media Queries into a Site The Widget Masters Website relies on standard CSS combined with HTML5 elements to provide the layout shown earlier. For example, to layout the menu bar shown at the top of the page the nav element is used as shown next. A standard div element could certainly be used as well if desired.   <nav> <ul class="clearfix"> <li><a href="#home">Home</a></li> <li><a href="#products">Products</a></li> <li><a href="#aboutus">About Us</a></li> <li><a href="#contactus">Contact Us</a></li> <li><a href="#store">Store</a></li> </ul> </nav>   This HTML is combined with the CSS shown next to add a CSS3 gradient, handle the horizontal orientation, and add some general hover effects.   nav { width: 100%; } nav ul { border-radius: 6px; height: 40px; width: 100%; margin: 0; padding: 0; background: rgb(125,126,125); /* Old browsers */ background: -moz-linear-gradient(top, rgba(125,126,125,1) 0%, rgba(14,14,14,1) 100%); /* FF3.6+ */ background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,rgba(125,126,125,1)), color-stop(100%,rgba(14,14,14,1))); /* Chrome,Safari4+ */ background: -webkit-linear-gradient(top, rgba(125,126,125,1) 0%, rgba(14,14,14,1) 100%); /* Chrome10+,Safari5.1+ */ background: -o-linear-gradient(top, rgba(125,126,125,1) 0%, rgba(14,14,14,1) 100%); /* Opera 11.10+ */ background: -ms-linear-gradient(top, rgba(125,126,125,1) 0%, rgba(14,14,14,1) 100%); /* IE10+ */ background: linear-gradient(top, rgba(125,126,125,1) 0%, rgba(14,14,14,1) 100%); /* W3C */ filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#7d7e7d', endColorstr='#0e0e0e',GradientType=0 ); /* IE6-9 */ } nav ul > li { list-style: none; float: left; margin: 0; padding: 0; } nav ul > li:first-child { margin-left: 8px; } nav ul > li > a { color: #ccc; text-decoration: none; line-height: 2.8em; font-size: 0.95em; font-weight: bold; padding: 8px 25px 7px 25px; font-family: Arial, Helvetica, sans-serif; } nav ul > li a:hover { background-color: rgba(0, 0, 0, 0.1); color: #fff; }   When mobile devices hit the site the layout of the menu items needs to be adjusted so that they're all visible without having to swipe left or right to get to them. This type of modification can be accomplished using CSS media queries by targeting specific screen sizes. To start, a media query can be added into the site's CSS file as shown next: @media screen and (max-width:320px) { /* CSS style overrides for this screen width go here */ } This media query targets screens that have a maximum width of 320 pixels. Additional types of queries can also be added – refer to my previous post for more details as well as resources that can be used to test media queries in different devices. In that post I emphasize (and I'll emphasize again) that CSS media queries only modify the overall layout and look and feel of a site. They don't optimize the site as far as the size of the images or content sent to the device which is important to keep in mind. To make the navigation menu more accessible on devices such as an iPhone or Android the CSS shown next can be used. This code changes the height of the menu from 40 pixels to 100%, takes off the li element floats, changes the line-height, and changes the margins.   @media screen and (max-width:320px) { nav ul { height: 100%; } nav ul > li { float: none; } nav ul > li a { line-height: 1.5em; } nav ul > li:first-child { margin-left: 0px; } /* Additional CSS overrides go here */ }   The following image shows an example of what the menu look like when run on a device with a width of 320 pixels:   Mobile devices with a maximum width of 480 pixels need different CSS styles applied since they have 160 additional pixels of width. This can be done by adding a new CSS media query into the stylesheet as shown next. Looking through the CSS you'll see that only a minimal override is added to adjust the padding of anchor tags since the menu fits by default in this screen width.   @media screen and (max-width: 480px) { nav ul > li > a { padding: 8px 10px 7px 10px; } }   Running the site on a device with 480 pixels results in the menu shown next being rendered. Notice that the space between the menu items is much smaller compared to what was shown when the main site loads in a standard browser.     In addition to modifying the menu, the 3 horizontal content sections shown earlier can be changed from a horizontal layout to a vertical layout so that they look good on a variety of smaller mobile devices and are easier to navigate by end users. The HTML5 article and section elements are used as containers for the 3 sections in the site as shown next:   <article class="clearfix"> <section id="info"> <header>Why Choose Us?</header> <br /> <img id="mainImage" src="Images/ArticleImage.png" title="Article Image" /> <p> Post emensos insuperabilis expeditionis eventus languentibus partium animis, quas periculorum varietas fregerat et laborum, nondum tubarum cessante clangore vel milite locato per stationes hibernas. </p> </section> <section id="products"> <header>Products</header> <br /> <img id="gearsImage" src="Images/Gears.png" title="Article Image" /> <p> <ul> <li>Widget 1</li> <li>Widget 2</li> <li>Widget 3</li> <li>Widget 4</li> <li>Widget 5</li> </ul> </p> </section> <section id="FAQ"> <header>FAQ</header> <br /> <img id="faqImage" src="Images/faq.png" title="Article Image" /> <p> <ul> <li>FAQ 1</li> <li>FAQ 2</li> <li>FAQ 3</li> <li>FAQ 4</li> <li>FAQ 5</li> </ul> </p> </section> </article>   To force the sections into a vertical layout for smaller mobile devices the CSS styles shown next can be added into the media queries targeting 320 pixel and 480 pixel widths. Styles to target the display size of the images in each section are also included. It's important to note that the original image is still being downloaded from the server and isn't being optimized in any way for the mobile device. It's certainly possible for the CSS to include URL information for a mobile-optimized image if desired. @media screen and (max-width:320px) { section { float: none; width: 97%; margin: 0px; padding: 5px; } #wrapper { padding: 5px; width: 96%; } #mainImage, #gearsImage, #faqImage { width: 100%; height: 100px; } } @media screen and (max-width: 480px) { section { float: none; width: 98%; margin: 0px 0px 10px 0px; padding: 5px; } article > section:last-child { margin-right: 0px; float: none; } #bottomSection { width: 99%; } #wrapper { padding: 5px; width: 96%; } #mainImage, #gearsImage, #faqImage { width: 100%; height: 100px; } }   The following images show the site rendered on an iPhone with the CSS media queries in place. Each of the sections now displays vertically making it much easier for the user to access them. Images inside of each section also scale appropriately to fit properly.     CSS media queries provide a great way to override default styles in a website and target devices with different resolutions. In this post you've seen how CSS media queries can be used to convert a standard browser-based site into a site that is more accessible to mobile users. Although much more can be done to optimize sites for mobile, CSS media queries provide a nice starting point if you don't have the time or resources to create mobile-specific versions of sites.

    Read the article

  • How to set child unordered list position?

    - by Joel
    Hi folks. I have a nav bar with children unordered lists nested under the main navbar items. My problem is on the inner list, when I position absolute, the inner list is centered to the page, and when I position relative, it is positioning inline with the parent list. I'm trying to get the first child item to line up directly under it's parent. /* OUTER LIST STYLING */ div#navbar2 { position:relative; width: 100%; border-top: solid #000 1px; border-bottom: solid #546F8B 1px; background-color: #546F8B; } div#navbar2 ul#navbar { padding: 0; margin: 10px 0; font-family: Arial, Helvetica, sans-serif; font-size: 16px; letter-spacing:1px; color: #FFF; white-space: nowrap; } div#navbar2 ul#navbar li { margin: 0 2px; list-style-type: none; display: inline; } div#navbar2 li a { text-decoration: none; color: #fff; padding: 10px 10px; } div#navbar2 li a:link { color: #FFF: } div#navbar2 li a:visited { color: #ffffff; } div#navbar2 li a:hover { color: #000; background-color: #FDFFC9; } /* INNER LIST STYLING */ div#navbar2 ul#navbar li ul.innerlist{ display: none; color:#000; } div#navbar2 ul#navbar li ul.innerlist li{ color:#000; } div#navbar2 ul#navbar li:hover ul.innerlist { position: absolute; display: inline; left: 0; width: 100%; margin: 40px 0 0px 0px; padding: 0px; color:#000; } div#navbar2 li.innerlist a { text-decoration: none; color: #000; padding: 10px 10px; } div#navbar2 li.innerlist a:link { color: #000: } div#navbar2 li.innerlist a:visited { color: #000; } div#navbar2 li.innerlist a:hover { color: #000; background-color: #FDFFC9; } And my html: <div id="navbar2"> <ul id="navbar"> <li id="index"><a href="index.php">About Rattletree</a></li> <li id="upcomingshows"><a href="upcomingshows.php">Calendar</a></li> <li id="booking"><a href="booking.php">Contact</a> <ul class="innerlist"> <li class="innerlist"><a href="#">Booking</a></li> <li class="innerlist"><a href="#">press</a></li> </ul> </li> <li id="instruments"><a href="instruments.php">The Band</a> <ul class="innerlist"> <li class="innerlist"><a href="#">The Instruments</a></li> <li class="innerlist"><a href="#">The Players</a></li> </ul> </li> <li id="classes"><a href="classes.php">Sights &amp; Sounds</a> <ul class="innerlist"> <li class="innerlist"><a href="#">Listen</a></li> <li class="innerlist"><a href="#">photos</a></li> <li class="innerlist"><a href="#">video</a></li> </ul> </li> <li id"classes"><a href="classes.php">Workshops &amp; Classes</a></li> </ul> </div> Thanks for any help!

    Read the article

  • Div not floating left

    - by Davey
    Can't seem to get this div to move to the left. Using wordpress. I tried a lot of things but am at a loss. Here is the css for the div: #portfolio li img { position: absolute; float: left; margin: 34px 50px 0 0; width: 942px; } Here is the header.php: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <!-- Design by Davey Whitney [email protected] --> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=<?php bloginfo('charset'); ?>" /> <link rel="stylesheet" type="text/css" href="wp-content/themes/zenlite/layout.css" media="screen" /> <link rel="stylesheet" type="text/css" href="<?php bloginfo('template_directory'); ?>/print.css" media="print" /> <link rel="stylesheet" type="text/css" href="wp-content/themes/zenlite/color.css" /> <script type="text/javascript" src="js/jquery.js"></script> <script type="text/javascript" src="js/jquery.kwicks-1.5.1.js"></script> <script type="text/javascript" src="js/jquery.innerfade.js"></script> <script type="text/javascript" src="js/custom.js"></script> <title> Wildfire </title> <script type="text/javascript" src="http://wfithaca.com/js/jquery.lavalamp.js"></script> <script type="text/javascript" src="http://wfithaca.com/js/jquery.easing.1.1.js"></script> <script type="text/javascript" src="http://wfithaca.com/js/jquery.cycle.all.min.js"></script> <script type="text/javascript"> function my_kwicks(){ $('.kwicks').kwicks({ duration: 300, max: 200, spacing: 0 }); } $(document).ready(function(){ my_kwicks(); }); </script> <script type="text/javascript"> $(document).ready( function(){ $('ul#portfolio').innerfade({ speed: 1000, timeout: 5000, type: 'sequence', }); }); </script> </script> <script type="text/javascript"> $(document).ready(function(){ $('li.headlink').hover( function() { $('ul', this).css('display', 'block'); }, function() { $('ul', this).css('display', 'none'); }); }); </script> </head> <body> <div id="wrapper"> <div id="header"> <ul id="portfolio"> <li> <img src="http://wfithaca.com/images/banner1.png" /> </li> <li> <img src="http://wfithaca.com/images/banner1.png" /> </li> <li> <img src="http://wfithaca.com/images/banner1.png" /> </li> </ul> </div> <div id="navigation"> <div id="kwickbar"> <ul class="kwicks"> <li id="kwick1"><a href="#">Home</a></li> <li id="kwick2"><a href="#">Menu</a></li> <li id="kwick3"><a href="#">Events</a></li> <li id="kwick4"><a href="#">Friends</a></li> <li id="kwick5"><a href="#">Contact</a></li> </ul> </div> </div> Here is the stylesheet: html,body { font-family:Tahoma, Verdana,Arial, Helvetica, sans-serif; font-size:100%; padding:0; color:#fff; border-style:none; } a { text-decoration:none; } a:hover,a:active,a:focus { text-decoration:none; } ul li { list-style-type:none; } ul.dbem_events_list a:link {color: #A32725; text-decoration: underline; } ul.dbem_events_list a:visited {color: #A32725; text-decoration: underline; } ul.dbem_events_list a:hover {color: #ffffff; text-decoration: none; } ul.dbem_events_list{text-decoration:none; list-style-type:none;} ul li ul li { list-style-type:none; } ul li ul li ul li { list-style-type: none; } q:before, q:after { content:""; } #wrapper { width:986px; margin: 0 auto; } #header { background-image:url('images/headframe.png'); width:986px; height:271px; } #kwickbar { padding: 25px 0 0 25px; } #navigation { width:984px; height: 100px; background-color: #000000; text-decoration:none; margin-left:1px; } .update-post { float:left; width:100px; } #content { float:left; height:100%; width:984px; background-color: #000000; text-decoration:none; margin-left:1px; } #postcontent{ height:100%; width:100%; } #content .post { float:left; width:90px; } #content .page,#content .attachment,.postcontent { color:#fff; width:720px; margin-top:15px; margin-left:30px; float:left; text-decoration:none; } .photo { width: 250px; height:700px; background-color:#000000; margin:0 0 0 880px; } .slideshow { height: 232px; width: 232px; margin:0 0 0 880px; } .slideshow img { border: 5px solid #000; } .post-title { margin:0; padding:0; } .post-title a { text-decoration:none; } .post-title a:hover,.post-title a:active,.post-title a:focus { text-decoration:underline; } #content .meta li,#content .prevnext li,#content .gallery li { list-style-image:none; list-style:none; } .meta { margin:5px 0 0; padding:0; font-size:.85em; } .meta ul,.meta li { margin:0; padding:0; } .meta ul { display:inline; } .meta li li { display:inline; padding-right:.3em; } .postfoot { clear:both; margin-bottom:20px; padding-bottom:10px; line-height:1.2em; } .author .posts-by { padding-top:10px; } #footer { clear:both; margin:0; padding:0 0 5px; text-align:center; font-size:.8em; border: 0; width:960px; } #footer ul { clear:both; margin:0; padding:0; } #footer li { display:inline; margin:0; padding:0 5px; } #footer li.rss { position:relative; top:3px; } .copyright { padding:50px 0 0 0; font-family:verdana; color:#ffffff; text-align:left; width:800px; font-size:0.8em; } .copyright a { text-decoration:none; color:#7E0000; font-weight:600; } .copyright a:hover { color:#C0D341; } . .postcontent p { text-decoration:none; border:0; border-style:none; } .postcontent p a:hover { color:#fff; } .kwicks { list-style-type: none; list-style-position:outside; position: relative; margin: 0; padding: 0; } .kwicks li{ display: block; overflow: hidden; padding: 0; cursor: pointer; float: left; width: 125px; height: 40px; margin-right: 0px; background-image:url('http://wfithaca.com/images/kwicks.jpg'); background-repeat:no-repeat; } .kwicks a{ display:block; height:40px; text-indent:-9999px; outline:none; } #kwick1 { background-position:0px 0px; } #kwick2 { background-position:-200px 0px; } #kwick3 { background-position:-400px 0px; } #kwick4 { background-position:-600px 0px; } #kwick5 { background-position:-800px 0px; } #kwick1.active, #kwick1:hover { background-position: 0 bottom; } #kwick2.active, #kwick2:hover{ background-position: -200px bottom; } #kwick3.active, #kwick3:hover { background-position: -400px bottom; } #kwick4.active, #kwick4:hover { background-position: -600px bottom; } #kwick5.active, #kwick5:hover { background-position: -800px bottom; } #portfolio li img { position: absolute; float: left; margin: 34px 50px 0 0; width: 942px; } Just want the #portfolio li img div to move to the left a bit. any help would be greatly appreciated.

    Read the article

  • Simple show/hide jQuery troubles

    - by Banderdash
    Okay, I feel like a bit of a 800 pound gorilla trying to thread a needle when it comes to jQuery. I need a script that will preform a simple show/hide (preferably with a nice sliding in and out) on a list. My markup looks like this: <div id="themes"> <h2>Research Themes</h2> <ul> <li class="tier_1"><a href="">Learn about our approach to the <strong>environment</strong></a> <ul class="tier_2 hide"> <li><a href=""><em>How we are tying this all together</em></a></li> <li><a href=""><strong>Project:</strong> Solor Powered Biofactories</a></li> <li><a href=""><strong>Project:</strong> Cleaning Water with Nature</a></li> <li><a href=""><strong>Project:</strong> Higher Efficiency Solar Technology</a></li> </ul> </li> <li class="tier_1"><a href="">Learn about our approach to <strong>human health</strong></a> <ul class="tier_2 hide"> <li><a href="">Project name numero uno goes here</a></li> <li><a href="">Project name numero dos goes here</a></li> <li><a href="">Project name numero tres goes here</a></li> </ul> </li> <li class="tier_1"><a href="">Learn about our approach to <strong>national defense</strong></a> <ul class="tier_2 hide"> <li><a href="">Project name numero uno goes here</a></li> <li><a href="">Project name numero dos goes here</a></li> <li><a href="">Project name numero tres goes here</a></li> </ul> </li> </ul> </div><!-- // end themes --> You can see that each nested ul has a class of "tier_2" and "hide". Ideally when the li they are nested within ("li.tier_1") is clicked it's child ul will have the hide class removed and the li's contained within will slideout, but at the same time should check all the other ul.tier_2's and be sure they get a hide class--so only one theme can be expanded at a time. I set up a sandbox to try some things: http://jsbin.com/odete/3 My JS looks like this: $(function(){ $(".tier_1 a").each(function(i,o){ $(this).click(function(e){ e.preventDefault(); $(this).addClass("show").siblings("ul").removeClass("show"); $("ul.tier_2:eq("+i+")").show().siblings("ul.tier_2").hide(); }); }); }); Totally a dumb way to do this, I am sure. But I based it off another script and it does work "a little bit" as you can see in the sandbox. If one of you mean hands at jQuery might be so inclined to take a peek I'd be very grateful. If you could also advise on how to have the transitions slideIn and Out that would also be fantastic!

    Read the article

  • Javascript Bookmarklet - Opening Multiple Links on a Page

    - by NessDan
    I want to make a bookmarklet so that when I go on Digg, I can simply click it and have the top 10 stories open up in new tabs. The HTML on the page looks like this: <div id="topten-list"> <div class="news-summary img-thumb"> <h3> <a href="/comics_animation/Pokemon_COMIC">Pokemon - (COMIC) <span> <em style="background-image: url(&quot;/comics_animation/Pokemon_COMIC/a.png&quot;);"> thumb</em> </span></a> </h3> <ul class="news-digg"> <li class="digg-count"> <a href="/comics_animation/Pokemon_COMIC"> <strong>1872</strong> </a> </li> </ul> </div> <div class="news-summary img-thumb"> <h3> <a href="/comedy/I_am_never_drinking_with_you_assholes_again_Pic"> I am never drinking with you assholes again [Pic] <span> <em style="background-image: url(&quot;/comedy/I_am_never_drinking_with_you_assholes_again_Pic/a.png&quot;);"> thumb</em> </span></a> </h3> <ul class="news-digg"> <li class="digg-count"> <a href="/comedy/I_am_never_drinking_with_you_assholes_again_Pic"> <strong>1650</strong> </a> </li> </ul> </div> <div class="news-summary news-thumb"> <h3> <a href="/comedy/xkcd_Hell">xkcd: Hell <span> <em style="background-image: url(&quot;/comedy/xkcd_Hell/a.png&quot;);"> thumb</em> </span></a> </h3> <ul class="news-digg"> <li class="digg-count"> <a href="/comedy/xkcd_Hell"> <strong>1407</strong> </a> </li> </ul> </div> <div class="news-summary news-thumb"> <h3> <a href="/arts_culture/6_Ridiculous_History_Myths_You_Probably_Think_Are_True"> 6 Ridiculous History Myths (You Probably Think Are True) <span> <em style="background-image: url(&quot;/arts_culture/6_Ridiculous_History_Myths_You_Probably_Think_Are_True/a.jpg&quot;);"> thumb</em> </span></a> </h3> <ul class="news-digg"> <li class="digg-count"> <a href="/arts_culture/6_Ridiculous_History_Myths_You_Probably_Think_Are_True"> <strong>1216</strong> </a> </li> </ul> </div> <div class="news-summary news-thumb"> <h3> <a href="/people/Why_Every_Chick_Flick_Is_Starting_to_Look_The_Same_CHART"> Why Every Chick Flick Is Starting to Look The Same [CHART] <span> <em style="background-image: url(&quot;/people/Why_Every_Chick_Flick_Is_Starting_to_Look_The_Same_CHART/a.jpg&quot;);"> thumb</em> </span></a> </h3> <ul class="news-digg"> <li class="digg-count"> <a href="/people/Why_Every_Chick_Flick_Is_Starting_to_Look_The_Same_CHART"> <strong>978</strong> </a> </li> </ul> </div> <div class="news-summary img-thumb"> <h3> <a href="/food_drink/WTF_World_of_FAST_FOOD_Graphic">WTF World of FAST FOOD! [Graphic] <span> <em style="background-image: url(&quot;/food_drink/WTF_World_of_FAST_FOOD_Graphic/a.jpg&quot;);"> thumb</em> </span></a> </h3> <ul class="news-digg"> <li class="digg-count"> <a href="/food_drink/WTF_World_of_FAST_FOOD_Graphic"> <strong>874</strong> </a> </li> </ul> </div> <div class="news-summary news-thumb"> <h3> <a href="/people/10_Things_You_Don_t_Know_About_My_Life_As_a_Dominatrix"> 10 Things You Don&#39;t Know About My Life As a Dominatrix <span> <em style="background-image: url(&quot;/people/10_Things_You_Don_t_Know_About_My_Life_As_a_Dominatrix/a.jpg&quot;);"> thumb</em> </span></a> </h3> <ul class="news-digg"> <li class="digg-count"> <a href="/people/10_Things_You_Don_t_Know_About_My_Life_As_a_Dominatrix"> <strong>751</strong> </a> </li> </ul> </div> <div class="news-summary img-thumb"> <h3> <a href="/odd_stuff/Star_Trek_Transporter_Mishap_pic">Star Trek Transporter Mishap (pic) <span> <em>thumb</em> </span></a> </h3> <ul class="news-digg"> <li class="digg-count"> <a href="/odd_stuff/Star_Trek_Transporter_Mishap_pic"> <strong>667</strong> </a> </li> </ul> </div> <div class="news-summary vid-thumb"> <h3> <a href="/pc_games/StarCraft_2_Beta_Breakup_Video">StarCraft 2 Beta Breakup (Video) <span> <em style="background-image: url(&quot;/pc_games/StarCraft_2_Beta_Breakup_Video/a.jpg&quot;);"> thumb</em> </span></a> </h3> <ul class="news-digg"> <li class="digg-count"> <a href="/pc_games/StarCraft_2_Beta_Breakup_Video"> <strong>627</strong> </a> </li> </ul> </div> <div class="news-summary news-thumb"> <h3> <a href="/politics/Jon_Stewart_FL_Doc_Won_t_Touch_Yr_Penis_If_You_Voted_Obama"> Jon Stewart: FL Doc Won&#39;t Touch Yr Penis If You Voted Obama <span> <em style="background-image: url(&quot;/politics/Jon_Stewart_FL_Doc_Won_t_Touch_Yr_Penis_If_You_Voted_Obama/a.jpg&quot;);"> thumb</em> </span></a> </h3> <ul class="news-digg"> <li class="digg-count"> <a href="/politics/Jon_Stewart_FL_Doc_Won_t_Touch_Yr_Penis_If_You_Voted_Obama"> <strong>508</strong> </a> </li> </ul> </div> </div> So within each div with the class "news-summary", there is a link. How can I get javascript to go through the div "topten-list" and open each one?

    Read the article

  • jQuery show hide divs on radio buttons

    - by RyanP13
    I have got a group of radio buttons that when clicked need to display a corresponding unordered list. I have got as far as showing the correct list according to which radio button is clicked but cannot figure out how to hide the other lists that need to be hidden. So if i click the second benefits radion then the second 'spend' ul will display and the other 'spend' uls will hide. This is my jQuery: // hide all except first ul $('div.chevron ul').not(':first').hide(); // $('div.chevron > ul > li > input[name=benefits]').live('click',function() { // work out which radio has been clicked var $radioClick = $(this).index('div.chevron > ul > li > input[name=benefits]'); var $radioClick = $radioClick + 1; $('div.chevron > ul').eq($radioClick).show(); }); // trigger click event to show spend list var $defaultRadio = $('div.chevron > ul > li > input:first[name=benefits]') $defaultRadio.trigger('click'); And this is my HTML: <div class="divider chevron"> <ul> <li><strong>What benefit are you most interested in?</strong></li> <li> <input type="radio" class="inlineSpace" name="benefits" id="firstBenefit" value="Dental" checked="checked" /> <label for="firstBenefit">Dental</label> </li> <li> <input type="radio" class="inlineSpace" name="benefits" id="secondBenefit" value="Optical" /> <label for="secondBenefit">Optical</label> </li> <li> <input type="radio" class="inlineSpace" name="benefits" id="thirdBenefit" value="Physiotherapy" /> <label for="thirdBenefit">Physiotherapy, osteopathy, chiropractic, acupuncture</label> </li> </ul> <ul> <li><strong>How much do you spend a year on Dental?</strong></li> <li> <input type="radio" class="inlineSpace" name="spend" id="rate1a" value="£50" /> <label for="rate1a">&pound;50</label> </li> <li> <input type="radio" class="inlineSpace" name="spend" id="rate2a" value="£100" /> <label for="rate2a">&pound;100</label> </li> <li> <input type="radio" class="inlineSpace" name="spend" id="rate3a" value="£150" /> <label for="rate3a">&pound;150</label> </li> </ul> <ul> <li><strong>How much do you spend a year on Optical?</strong></li> <li> <input type="radio" class="inlineSpace" name="spend" id="rate1b" value="£50" /> <label for="rate1a">&pound;50</label> </li> <li> <input type="radio" class="inlineSpace" name="spend" id="rate2b" value="£100" /> <label for="rate2a">&pound;100</label> </li> <li> <input type="radio" class="inlineSpace" name="spend" id="rate3b" value="£150" /> <label for="rate3a">&pound;150</label> </li> </ul> <ul> <li><strong>How much do you spend a year on Physiotherapy, osteopathy, chiropractic, acupuncture?</strong></li> <li> <input type="radio" class="inlineSpace" name="spend" id="rate1c" value="£50" /> <label for="rate1a">&pound;50</label> </li> <li> <input type="radio" class="inlineSpace" name="spend" id="rate2c" value="£100" /> <label for="rate2a">&pound;100</label> </li> <li> <input type="radio" class="inlineSpace" name="spend" id="rate3c" value="£150" /> <label for="rate3a">&pound;150</label> </li> </ul> <label class="button"><input type="submit" value="View your quote" class="submit" /></label> </div> I tried using: $('div.chevron > ul').not($radioClick).hide(); But that yielded a bad result where all the lists where hidden. Thanks in advance.

    Read the article

  • CSS selector not resolved when using UI Binder

    - by Zhaidarbek
    Basically, I am building a horizontal navigation bar. I have following markup: <ui:style src="../common.css" type="client.resources.HomeResources.Style"> @external gwt-Anchor; .gwt-Anchor { text-decoration: none; } </ui:style> <g:HTMLPanel styleName="navbar"> <ul> <li><g:Anchor ></g:Anchor> |</li> <li><g:Anchor ></g:Anchor> |</li> <li><g:Anchor ></g:Anchor> |</li> <li><g:Anchor ></g:Anchor> |</li> <li><g:Anchor ></g:Anchor> |</li> <li><g:Anchor ></g:Anchor> |</li> <li><g:Anchor ></g:Anchor></li> </ul> common.css has following rules: ul { margin: 0; padding: 0; text-align: left; font-weight: bold; line-height: 25px; } ul li { display: inline; text-align: right; } ul li a { color: #0077C0; font-size: 12px; margin-right: 15px; padding: 4px 0 4px 5px; text-decoration: none; } ul li a:HOVER { color: #F0721C; } When using rules as defined above, everything works perfect. The problem is that I have ul elements in other parts of page, so I've added div.navbar before each rule like this: div.navbar ul{} div.navbar ul li{} etc... But those rules are not applied to ul elements inside UI Binder template. What's wrong with my code? Here is the generated HTML (normally on one line): <div class="navbar"><ul> <li><a class="gwt-Anchor">Item 1</a> |</li> <li><a class="gwt-Anchor">Item 2</a> |</li> <li><a class="gwt-Anchor">Item 3</a></li> </ul></div> RESOLVED styleName="navbar" must be styleName="{style.navbar}"

    Read the article

  • style problem with jQueryUI Autocomplete widget (using remote datasource)

    - by blee
    <input class="ui-autocomplete-input"/> represents the text field to be autocompleted. <ul>...</ul> contains the list of matching items from the text field input. It is added to the document by remote call as you type. <ul>...</ul> is added just inside the closing </body> tag. I was expecting the <ul>...</ul> to be placed just after the <input class="ui-autocomplete-input"/>. Because this does not happen, the <ul>...</ul> falls outside of the containing div and the resulting style is broken. Suggestions? Can I specify where the <ul>...</ul> gets placed in the document? Thanks in advance for your time.

    Read the article

  • JQUERY - jQuery UI Nested Sortables 2 - help getting it working

    - by nobosh
    Hello, I'm interested in using the following JQUERY - http://lucaswoj.com/2010/01/jquery-ui-nested-sortables-2/ However, I can't seem to get a demo instance of the plugin work. Here's the code I'm using: <script type="text/javascript"> $('#findit').nestedSortable({}); </script> <div > <ul id="findit"> <li> List Item Content <ul></ul> <li> <li> List Item Content 2 <ul></ul> <li> <li> List Item Content 3 <ul></ul> <li> <li> List Item Content 4 <ul></ul> <li> <ul> </div> Any ideas? Thanks

    Read the article

  • Trying to get these list items to display inline

    - by Joel
    I have several unordered lists that I want to display like this: <ul> <li><img></li> <li><p></li> //inline </ul> //linebreak <ul> <li><img></li> <li><p></li> //inline </ul> ...etc I'm not able to get the li items to be inline with eachother. They are stacking vertically. I have stripped away most styling but still can't figure out what I'm doing wrong: html: <ul class="instrument"> <li class="imagebox"><img src="/images/matepe.jpg" width="247" height="228" alt="Matepe" /></li> <li class="textbox"><p>The matepe is a 24 key instrument that is played by the Kore-Kore people in North-Eastern Zimbabwe and Mozambique. It utilizes four fingers-each playing an individual melody. These melodies also interwieve to create resultant melodies that can be manipulated thru accenting different fingers. The matepe is used in Rattletree as the bridge from the physical world to the spirit world. The matepe is used in the Kore-Kore culture to summon the Mhondoro spirits which are thought to be able to communicate directly with Mwari (God) without the need of an intermediary.</p></li> </ul> <ul class="instrument"> <li class="imagebox"><img src="/images/soprano_little.jpg" border="0" width="247" height="170" alt="Soprano" /></li> <li class="textbox"><p>The highest voice of the Rattletree Marimba orchestra is the Soprano marimba. The soprano is used to whip up the energy on the dancefloor and help people reach ecstatic state with it's high and clear singing voice. The range of these sopranos goes much lower than 'typical' Zimbabwean style sopranos. The sopranos play the range of the right hand of the matepe and go two notes higher and five notes lower. Rattletree uses two sopranos.</p></li> </ul> <ul class="instrument"> <li class="imagebox"><img src="/images/bari_little.jpg" border="0" width="247" height="170" alt="Baritone" /></li> <li class="textbox"><p>The Baritone is the next lower voice in the orchestra. The bari is where the funk is. Generally bubbling over the Bass line, the baritone creates the syncopations and polyrhythms that messes with the 'minds' of the dancers and helps seperate the listener from the physical realm of thought. The range of the baritone covers the full range of the left hand side of the matepe.</p></li> </ul> <ul class="instrument"> <li class="imagebox"><img src="/images/darren_littlebass.jpg" border="0" width="247" height="195" alt="Bass"/><strong>Bass Marimba</strong></li> <li class="textbox"><p>The towering Bass Marimba is the foundation of the Rattletree Marimba sound. Putting out frequencies as low as 22hZ, the bass creates the drive that gets the dancefloor moving. It is 5.5' tall, 9' long, and 4' deep. It is played by standing on a platform and struck with mallets that have lacross-ball size heads (they are actually made with rubber dog balls). The Bass marimba's range covers the lowest five notes of the matepe and goes another five notes lower.</p></li> </ul> <ul class="instrument"> <li class="imagebox"><img src="/images/wayne_little.jpg" border="0" width="247" height="177" alt="Drums"/><strong>Drumset</strong></li> <li class="textbox"><p>All the intricate polyrhythms are held together tastefully with the drumset. The drums provides the consistancy and grounding that the dancers need to keep going all night. While the steady kick and high-hat provide that grounding function, the toms and snare and allowed to be another voice in the poylrhythmic texture-helping the dancers abandon the concept of a "one" within this cyclical music.</p></li> </ul> css: ul.instrument { text-align:left; display:inline; } ul.instrument li { list-style-type: none; } li.imagebox { } li.textbox { } li.textbox p{ width: 247px; }

    Read the article

  • need to generate unlimited number of unique id's with jQuery

    - by jquery n00b
    Hi all, extreme n00b here... I've got a number of elements (dynamically generated by back end so it could be quite a few) and all need a unique id. I'm trying to work out how to do this wth jQuery and not doing so well. Any help is appreciated. In the code below, I'd want each "bar" div to get a unique id, like id1, id2 etc etc <div class="foo"> <ul class="bar"> </ul> <ul class="bar"> </ul> <ul class="bar"> </ul> <ul class="bar"> </ul> </div>

    Read the article

  • Home link on the menu does not highlight

    - by strangeloops
    My menu shows the active links when clicked on it except for the home link (http://www.obsia.com). It is never highlighted. I tried playing around but I can't seem to figure it out. This is the jquery code I used to highlight the links? $(function(){ var path = location.pathname.substring(1); if ( path ) $('.nav a[href$="' + path + '"]').attr('class', 'active'); }); I also have another menu on the products pages where I would like to highlight the parents of the siblings and the our products on the global menu. This is the jquery code for the products menu: $(function() { var pathname = location.pathname; var highlight; //highlight home if(pathname == "") highlight = $('ul#accordion > li:first > a:first'); else { var path = pathname.substring(1); if (path) highlight = $('ul#accordion a[href$="' + path + '"]'); }highlight.attr('class', 'active'); // hide 2nd, 3rd, ... level menus $('ul#accordion ul').hide(); // show child menu on click $('ul#accordion > li > a.product_menu').click(function() { //minor improvement $(this).siblings('ul').toggle("slow"); return false; }); //open to current group (highlighted link) by show all parent ul's $('a.active').parents('ul').show(); $('a.active').parents('h2 a').css({'color':'#ff8833'}); //if you only have a 2 level deep navigation you could //use this instead //$('a.selected').parents("ul").eq(0).show(); }); }); I tried adding this: $(this).parents('ul').addClass('active'); but that does not seem to do the trick? Does anybody have a simple way of accomplishing it? Any help would be appreciated from you guys. Kind Regards, G

    Read the article

  • Display hidden li based on class

    - by kylex
    I have the following list structure: <ul> <li>One</li> <li>Two <ul> <li class="active">Two-1</li> <li>Two-2</li> </ul> </li> <li>Three <ul> <li>Three-1</li> </ul> </li> </ul> with the following CSS: ul li ul{ display:none; } ul li:hover ul{ display:block; } What I would like is this: When an li class is active, the entire structure down until the active class gets displayed. so in the case provided the following would show, along with the top level: One Two Two-1 Two-2 Three I'd like either a CSS or jQuery implementation (or mixture of the two) if possible.

    Read the article

  • closing an unordered list

    - by snorpey
    On a website, I want to display the main navigation as an unordered list. After 3 items I want to close that list and open a new one, so it eventually looks something like this: <div id="navigation"> <ul> <li>1</li> <li>2</li> <li>3</li> </ul> <ul> <li>4</li> <li>5</li> <li>6</li> </ul> </div> The navigation is dynmically generated using jQuery + Ajax. This is what the code I'm using looks like: $.getJSON("load.php", { some: value }, function(data) { $.each(data.items, function(i, item) { $('#navigation').find('ul').append('<li>' + i + '</li>'); if(i % 3 == 0) { $('#navigation').find('ul').append('</ul><ul>'); } }); }); Unfortunately, the browser doesn't interpret this right and treats the closing ul tag as a nested object of the first ul. How do I fix this?

    Read the article

  • Howto serialize multiple Lists with Jquery

    - by megens
    I have 3 sortable UL's and a simple jquery/javascript <ul class="sortable" id="menu1"> <li id="id_1">whatever</li> <li id="id_2">you</li> </ul> <ul class="sortable" id="menu2"> <li id="id_3">wanne</li> <li id="id_4">put</li> </ul> <ul class="sortable" id="menu3"> <li id="id_5">in</li> <li id="id_6">here</li> </ul> $(function() { $("ul.sortable").sortable({ connectWith: 'ul' }); }); </script> LI's are draggable between UL's How can i serialize this so i get for example menu1[0]=1&menu1[1]=3 Or and array or whatever i can work with to save the state?

    Read the article

  • How can I collapse a nested list using jQuery?

    - by Bradley Herman
    I have a nested list: <ul> <li><a href='#'>stuff</a></li> <li><a href='#'>stuff2</a></li> <ul> <li><a href='#'>stuff3</a></li> </ul> <li><a href='#'>stuff4</a></li> </ul> ...and want to collapse the nested ul when the li is clicked. Before I was using $('UL LI').click(function(){ $(this).next().slideToggle(); }); ...but this obviously causes a problem when a li doesn't have a ul nested after it. Is there a better way to do this, or is there a way for me to determine if the object returned by $(this).next() is a UL?

    Read the article

  • What am I doing wrong for this submenu to not appear?

    - by Doug
    I'm new to jQuery, so please bear with me. I'm trying to make my submenu appear on hover. The second set of <ul> is for submenu. $(document).ready(function(){ $('ul.menu.li').hover( function() { $('ul', this).css('display', 'block'); }, function() { $('ul', this).css('display', 'none'); }); }); <ul id="menu"> <li><a href="#">Item 1</a><li> <ul> <li>Hi</li> </ul> <li><a href="#">Item 2</a></li> </ul>

    Read the article

< Previous Page | 4 5 6 7 8 9 10 11 12 13 14 15  | Next Page >