Solved

Help to customize jQuery icon position

Posted on 2014-01-24
5
968 Views
Last Modified: 2014-01-29
I'm working on the UI/UX for a listing/index landing page for audio files and using jQuery accordion to deal with what will eventually be an index of nearly 2000 titles or more spanning from 1958 to 2014.

see: http://dev.himalayanacademy.com/looklisten/inspired-talks

the top level headers are by year that the audio files were posted, these are the Accordion disclosure selectors.

I am not able to get the disclosure triangles

class="ui-icon ui-icon-triangle-1-s  
  # pointing down if the div is open and visible
class="ui-icon ui-icon-triangle-1-e  
  # pointing to the right when the div is collapsed by default

to align to the left of the header element.

Note that I'm not loading any jQuery UI scripts or UI CSS... which may be my problem, We don't use it that much so I'm thinking to keep the weight of the page down to just add just enough CSS to do the job.. but I'm missing something. even minified the ui is over 200k of js.

For now I'm running the styles in line for testing purposes...and to make sure I override the main styles.js for the site. later I'll put the css into the main style sheet.

Aside from the solution needed to get the triangle over to the left of the H3 element, I'll be all ears for any thoughts you have on the UX... I decided to avoid JS for the disclosure of the description of the audio file... and went with css-hover... as I'm not sure forcing users to click on a "More.." button to hide and show that div is any better than hover; and hover works with touch on smart phones... so seems like as good a UX as using JS to do the job... It also makes it simpler for me to generate the lists from the database later on, because I won't have to dynamically apply unique div ID's throughout the index which I think would be required to make the JS work using a button onclick trigger. OTHO if you have a better idea  then I'm all ears... I should probably make that a separate question once I get the triangle position solved.
0
Comment
Question by:Brahmanatha
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
5 Comments
 
LVL 53

Expert Comment

by:Scott Fell, EE MVE
ID: 39808637
>Note that I'm not loading any jQuery UI scripts or UI CSS
I think you are when looking at your code
<!--[if IE]><script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script><![endif]-->
	<!-- script src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js"></script> -->
	<link rel="stylesheet" href="/assets/css/ui-lightness/jquery-ui-1.8.18.custom.css" type="text/css" media="screen, projection" />
	<link rel="stylesheet" href="/assets/css/ddd-banner.css" type="text/css" media="screen, projection" />
	<script src="/assets/js/jquery-1.7.1.min.js"></script>
	<script src="/assets/js/jquery-ui-1.8.18.custom.min.js"></script>
	 <!-- <script src="/assets/js/jquery-1.9.1.min.js"></script>-->
	 <!-- <script src="/assets/js/jquery-ui.min.js"></script>-->

Open in new window


Many sites use jquery and jquery ui without issue or other libraries.  Think of all the sites run with wordpress and those are plenty bulked up well beyond what you are talking about.   If you are talking about using hover working only for smart phones, then you are excluding older versions of ie.  If that is the case, you use jquery 2.x which is only about 85k plus whatever the accordion requires.
0
 
LVL 25

Accepted Solution

by:
Kyle Hamilton earned 500 total points
ID: 39808705
to see the triangle, override the following class, by giving the h3 some padding:

.ui-accordion .ui-accordion-header {
cursor: pointer;
position: relative;
margin-top: 1px;
zoom: 1;
padding-left: 30px;
}

Open in new window


I find those hovers incredibly annoying. It makes it very difficult to scroll through the titles. I would either provide some delay, or make them open on click. You do not need ids for each one.

To make them open on click you can do this:
$(".audio-index-list").on("click", "li", function(){
  $(this).addClass("open").siblings().removeClass("open"));
});

Open in new window

remove the hover class (#accordion li:hover), and add this instead:
.open{
   white-space: normal;
   overflow: visible;
   display: block;
}

Open in new window

0
 

Author Comment

by:Brahmanatha
ID: 39818646
Duh!  my code was OK but had an extra parenthesis! I need to learn how to use JSlint.
0
 

Author Closing Comment

by:Brahmanatha
ID: 39818650
Thanks Kyle!
0
 
LVL 25

Expert Comment

by:Kyle Hamilton
ID: 39818666
:)
0

Featured Post

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction If you're like most people, you have occasionally made a typographical error when you're entering information into an online form.  And to your consternation, the browser remembers the error, and offers to autocomplete your future entr…
So you have coded your own WordPress plugin and now you want to allow users to upload images to a folder in the plugin folder rather than the default media location? Follow along and this article will show you how to do just that!
In this tutorial viewers will learn how add a scalable full-width header using CSS3. Create a new HTML document with an internal stylesheet. Set a tiled background.:  Create a new div and name it Header. Position it with position:absolute at the top…
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

737 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question