Shoe-horning a tabbed CSS show/hide element where it did not exist before - css

I developed a CSS-based layout for a web application that has been locked down and awaiting back-end integration. The primary element on the page is a timer/clock.
As originally intended, the timer is just a timer and is very simple. It looks like this:
Now, the boss has asked me to make a pretty significant change to my design. They want 3 tabs to hang off the bottom of the clock. They did not want this before, so I didn't build any show/hide logic and I didn't build tabs under the clock either. I am also slightly concerned because the tabs are at the bottom of the clock - that seems like a point of curiosity but I am guessing it is not huge problem either. Clicking on any of the tabs needs to cause the tab that was just clicked on to have focus, and it would cover the black rounded rectangle and display information about the tab the user clicked on. It would cover the clock. I would describe their request as reasonable, but I wish I'd had this requirement when I was coding. I think it sounds like a relative of a show/hide toggle. This is how they want the tabs to look, and where they want the tabs to go:
The part I am getting stuck on is how to slipstream something like this into what I've already created for the clock. Effectively they need me to make that component much more interactive, as the tabs have quite a bit of functionality within them. There are 3 tabs that I envision needing, but the mockup only shows 2, and that's ok.
I've included a few images in this post and I hope it helps. I've spent nearly a week smashing my head against this and I am stuck. To sum it up, I need to introduce (or shoehorn) a show/hide component as part of a late-hour change.
I am decent with CSS/JS/Web dev, but this is my Achilles heel. By "this" I mean taking a part of the UI that I already created and making it behave totally differently. In this case a pretty simple timer needs to change and has to have tabs at the bottom of the clock that would cover the clock itself when clicked. I hope I was clear enough in this question.

You have a very simple way to resolve this, using JQuery (you can use Javascript on it's own, but this will make it easier for you, less writing).
The give an ID to the DIV where you have the HTML for the clock, move the entire HTML content into a declaration like this:
$("#myDivId").html("put all the HTML content here, don't worry with the size of it");
you just need to change the HTML based on what you want to display. For easier implementation you can create a variable for each different content options, like this:
var myFirstHtmlBlock = "<p>blah blah blah</p>";
var mySecondHtmlBlock = "<span>Anything else...</span>";
and then change the content using those variables:
$("#myDivId").html(mySecondHtmlBlock);
Just let me know if this sorted out your issue.

Related

Changing my website cursor into a coffee icon, pouring coffee whenever the user clicks on something

I have a personal website and I want to spice it up a bit while also learning some front-end.
An idea I had was that the cursor of my website would be a coffee instead of the default one, and anytime I click on any content, the coffee pours.
Any idea if this is possible and if so, what I need to do to implement it?
You can change the cursor using CSS - see https://www.w3schools.com/cssref/pr_class_cursor.asp and do something like
div {
cursor:url(myCoffeeJug.cur),auto;
}
You could then use Javascript to change the cursor shape (ie URL) when the user clicks in the div. You'd need to think how to change it back again after whatever operation the click triggers is complete.
Note that you can't do animations this way - but given that clicking on a div is likely to be quite a quick action, just switching to and back from a different icon might well be enough for what you want.
However this is perhaps not a great idea from the usability point of view. Web users are used to the basic types of cursor provided by browsers - overriding them may be cute, but it can also be confusing.
If your site is designed for 'ordinary' users looking for information or functionality (rather than for web designers, or as a showcase for your techniques), you're putting a small barrier in their way. Users who are not confident, or are new to all this, or non-neurotypical users may find it off-putting.

Styling issues with react-native-gesture-handler

New to react native and stackoverflow. I am restyling a project that lets you take notes as you read the bible. I am trying to use react-native-gesture-handler so I can get rid of these ugly delete and edit buttons that I have smashed together on each note.
My problem is that since my note components are transparent, using the swiping gesture to render a delete button causes the delete button to jarringly pop into existence, instead of giving the effect of peeking out from behind the note component as you swipe. If I made my note component background opaque this wouldn't be an issue, but I do like the thematic direction I'm taking and I don't tear it up and rethink the theme if I don't have to.
I'm not allowed to add screenshots yet for some reason, so check the link below to see what I mean.
Any recommendations on how I can get this delete button to slide in from the right as you swipe? Or maybe a clever way to restyle the note component or delete button to make this look nice without sacrificing the cool theme? Thank you!
See Screenshot

How to apply any style to FullCalendar cells

great people from Stack!
I'm having some issues working with Full Calendar I would like to get some help with.
First of all, Full Calendar is an amazing tool. Everything I have had any doubt with has been solved in a breeze just by taking a look at the docs or googling five minutes. However, there is a problem I'm dealing with and can't find (I'm starting to suspect it is virtually impossible, or at least it is for me to imagine how to do it) the way to get it solved.
I'm implementing this library in a project which is meant to be something like an appointments manager, among other things. A (simple) functionality I wanted to add is to open a modal when a calendar cell (agenda week would be the main view) is clicked with a form, allowing to create an appointment for the selected cell. To improve usability, I thought it would be nice if the cells had some kind of hover effect, so that you can feel there is 'something' behind clicking this element. The thing is, the calendar is composed by something like 2 separated overlapping tables, one with rows and the other with columns, that form the grid. The modal system is done and working, dayClick made the trick. Any way to do anything similar to what I am talking about, the hover stuff? (my idea was to make some kind of (+) button appear when hovering, but anything would work.
Thank you!
Seth
Edit: I noticed there is a 'selectable' directive which, given only to the AgendaWeek view, allows me to select cells. The selection is made by the JS code, adding an element just above the cell, with its dimensions. Wouldn't it be any way to call this from hovering a cell instead of just clicking it? I wonder that highlight cell is rendered from the position of the mouse at the time of the click and wouldn't be very efficient to check that all the time...

customize carousel help required

I need suggestions in building below UI. It's a carousel like structure where active over is highlighted in green and we can still see next overs disabled or gray color.
I have researched for this for ex. Can I make use of any carousel to fit this design but can't seem to come to any conclusion. Thought of slider also but did not see that fitting this design.
Guys, do you have any suggestion or pointers to get me started here. I do not need code; just want a startup point. So far I am stuck with carousel or slider.
I understand this might not be most constructive question on SO but any pointers will be highly appreciated.
Unfortunately, you didn't provide any information about what should happen when you click on these items. If I understand correctly, you are looking for a carousel supporting your own pager design. If this is correct, you must add the pager markup first, after that you can use any carousel that supports slide switching methods. Then you can add click event listener to your pager items and call switching method in the listener, setting by that a new slide corresponding to the pager element index.
For example, you can try slick carousel, as it has .slickGoTo() method, which you can use to switch slides programmatically. You can also try to customize slick's default pager, but it might be not so easy or even impossible at all.

How to design an accordion menu, for mobile, where the expander elements are also links

I have a Mobile design to fulfil:
The menu is a fairly standard Accordion setup.
It starts collapsed.
Tapping anywhere on A will expand it to show the A sub-menu.
Tapping anywhere on B will collapse A and expand B.
Tapping anywhere on A Sub 1 will take you to that link.
All standard so far! But the additional Feature is that A is itself a page that the user might want to access!
We have to fulfil this very specific design, so we can't add expander controls, to separate the link from the expand.
I was originally using simple nested <ul> lists and some trivial JS to bind into the onclick events. That was fine for elements that were links OR expanders but that fell apart on bits that were both.
I tried changing the behaviour to exposes the submenu on hover, to utilise the behaviour that I discovered, and documented here: Tablets hover on first click, click on second click
That does technically work, but not very well: you can't scroll the menu properly because touching outside your current expansion will change the selection; the hover exposure of the submenu isn't animated; it generally doesn't actually work well for phones and on a small desktop screen it's completely unusable.
I've looked for ages online for an example or a library that will Just Do This, but nothing fits what I need, and we've been given this very specific design spec.
Currently my only solution is going to be to implement the 2 phase clicking myself in javascript, storing the current state of the element in data attributes and reading those before deciding what action to take on click.
Is there any better way to achieve this?
=-=-=-=-=-=-=-=-=-=-=-=
See here for SO posts about related scenarios for a traditional navbar menu:
Tablets hover on first click, click on second click
https://stackoverflow.com/questions/29354150/deactivate-hover-on-tablet
You just need sit at your computer and watch for responses in about 50 years when all programs will include multiple touch, voice recognition, and thought features to accommodate your functionality request.
Personal experience dictates this problem will not be solved in less then 5 to ten years based on Moore's Law and general apathy on the internet.

Resources