Solved

Help to customize jQuery icon position

Posted on 2014-01-24
5
985 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

Don't Cry: How Liquid Web is Ensuring Security

WannaCry is just the start. Read how Liquid Web is protecting itself and its customers against new threats.

Question has a verified solution.

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

Styling your websites can become very complex. Here I'll show how SASS can help you better organize, maintain and reuse your CSS code.
CSS is a visual language used to classify objects and define rules about how they should be displayed. CSS skills aren’t restricted to developers anymore, there is a big benefit to having a basic understanding of the language, regardless of your occ…
In this tutorial viewers will learn how to embed custom externally-hosted Google Fonts using the Google Font API in CSS Go to the Google Fonts website at google.com/fonts: Browse or search based on font properties or name to find a suitable font for…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)

688 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