I am creating a website using a jQuery hover effect. The website is perfect on desktop, with the mouse on the image I have an hover effect that put a black layer on the image and show the text inside of the box, then click on the link inside and I will redirected to the page, but when I try on ipod touch/iphone/ipad it doesn't work.
Here is the fiddle: http://jsfiddle.net/IronFeast/RvfQg/
How can I modify my code? I'd like to recreate a double click on the box to show what's inside:
1st click) selection;
2nd click) start the effect.
Any help would be appreciated.
I like how you're using all CSS here. You're question isn't entirely clear, but I think that this is what you want: http://jsfiddle.net/howlermiller/fUSXp/2/ (try on an iPad)
It would be super simple to get this functionality using jQuery, but since you already put in some work to make it all out of CSS, I kept my answer as all CSS. I used the checkbox hack, and I tested it on an iPad to make sure that it works.
This hack works on desktop browsers too, so if you click on the box then the styling will stay, rather than going away on mouse off. That could be either a good thing or a bad thing, depending on what you're going to do with it.
P.S. Using pure css (aka the checkbox hack) isn't really the best way to do this. It makes your code a little less flexible and less reusable. But it does work perfectly well.
EDIT: Stop the presses, there's a bug in Safari 5. I found it thanks to this StackOverflow question. All you have to do to fix it is to add an empty onclick to the label (yeah yeah, another hack, I know, I'm not happy about it either). In my own tests Safari 6 does not seem to have this bug, so you won't need it unless you're supporting Safari 5 (which, realistically, is probably a good idea right now. If you're using this in a few months though, then you could probably use the old fiddle). Here's the fixed jsfiddle: http://jsfiddle.net/howlermiller/fUSXp/3/
As an alternative you could also try adding a class like 'hover' to an element when it is clicked and modify your CSS to animate on both cases: using pseudo-selector like :hover and when the element actually has the class 'hover'.
You will probably want to remove the class from all other siblings of the clicked element before you added to the currently clicked element.
The changes in the CSS will be similar to this :
.view-sixth.hover a.info,
.view-sixth:hover a.info {...}
so basically adding two similar selectors for each of the animated elements.
Related
I have a div with some simple text inside, but whenever i apply the class "sidebar-ad" or "sidebar-advertisement", i get the following output:
I have searched my directory for "sidebar-ad" with Windows Grep, and I am not using this selector in my css, or in any js.
Currently i'm just using a different selector ("sidebar-ads"), but what exactly is happening here? I tested using this same class on another project which is on another server and i had the same thing happen.
What is this [hidden] tag that's being added? http://prntscr.com/cy5861
Sorry for the stupid question, but this is baffling me.
Thanks.
Edit, i tested with Edge and this isn't happening there. What is Chrome doing?
Edit, it's also happening with "sidebar-ads", so i'm now using "ad" lol
This is the Adblock extension modifying the HTML so your ads doesn't display.
If you disable it on this page, you will not see this css class anymore.
Building a basic Php web site and my "Events" and "Join" pages jump slightly to the right when moving from page to page. I know this is something really simple, yet I can not remember, nor figure out what I have done wrong. Any help sincerely appreciated.
(link has been removed because this question has been answered)
This is actually a rather interesting exercise. For most circumstances, the comments provided by #Vainglory07 and #Kristen are correct: just live with the fact that scrollbars are going to make a centered page jump slightly between pages. In the common case that most of what you're doing is in some sort of container HTML tag there are ways of manipulating the location of the container to keep it from moving when a scrollbar appears. In case this bothers you (it looks you went with just making the container sufficiently long that a vertical scrollbar does appear), there are two possible solutions I can think of.
(Easy, but forces you to make design tradeoffs) Design your page around CSS that specifies the left attribute of some container tag, e.g. either some container div or the body tag, which people often forget is perfectly fine as a container by itself. This precludes you from centering the container or otherwise moving it around.
(Harder, but gives you the ability to center) Many times we would prefer for our container to be centered rather than aligned from the left. #Reigel gives a nice example of using Javascript to detect whether a scrollbar is present at How can I check if a scrollbar is visible?. Using the same idea we can keep our container from moving from the user's point of view when a scrollbar pops up.
Note that the second solution will cause problems if you're trying to follow responsive CSS paradigms. The second solution is also fairly brittle. Resizing the page will mean the calculations for figuring out how much space to add to a side of the container get thrown off and the page will have to be reloaded. Moreover, this is overkill for most (almost all) circumstances; often it's easier to just ignore the "jump" that occurs when a scrollbar appears. You get used to it after a while. So the general solution is just live with it. For those people who obsess over that "jump" though, there's at least a partial solution for you guys.
I see Google doing this all the time. They are able to successfully create a lightbox that can't be ignored... and even though the content behind it is visible (i.e. a form you would otherwise be able to fill out), you cannot do anything with that content-- I've even tried using the Document Inspector to get around the forced lightbox, and it's very, very difficult.
So, I'm not as concerned with the validation of the content BEHIND the box as I am with really nailing home the point that the lightbox is "not to be messed with". In other words, what's the best way to show a box that the user isn't supposed to (or able to) click out of until they've completed the action thereupon, while simultaneously showing a desaturated or partially whitened-out (but still visible) version of the content behind it?
As I said, I can code to make certain that the content behind the box isn't actually usable unless the requisite actions have been completed (so even if they get around it, it won't be functional). I just want to be a bit more stern with the people out there (like me) who will try simple things like a JavaScript blocker to prevent the content from lightboxing properly. Ideally, the solution I'm looking for would be cross-platform compatible and difficult to get around. I'm open to any type of solution that can be done via open-source code.
http://fancybox.net/
has an option hideOnContentClick: false that will only allow the user to click the "X" button in the fancy box to hide it. You could hide the "X" close button through css or take it out completely and have a javascript call when the user has completed all the fields or submitted to close the box.
Hope I read your question right.
Most lightbox features come with this. However, making your own, it's a 2 layer concept. 2 DIV's basically. One which spans to all 4 corners of the open browser. Most people will give it a color or something black and then set a transparency on it. After that you set a high zindex on it. Once you have that one in place you put another DIV inside of that one to mimic your lightbox needs. This way a user can't just click around the box and get to what they want. All in all though, javascript and CSS are easy to work around, all you need is a developer tool in your browser to just turn them off leaving you with only the raw form.
EDIT
Bottom line is, anything in the client side is always fallible. If someone's determined enough they will get around it. And if your doing it as a means of security from bots, that won't work, if someone who controls the bot is smart enough. I'm only saying this cause I hope there's not any false hopes that it will be a means to an end of a problem some how. Don't get me wrong it will detour many to a point, but those with malicious intent will break the concept easily with a little XSS or other various measures designed to break client-side only concepts.
EDIT 2
Both Jquery UI and Bootstrap from Twitter have good Dialog concepts that a normal every day user of your site won't be able to smash around easy.
I am trying to implement tabs within one tab and I would like some help with it.
I found some codes for the upper tab and tried to implement them into the lower set of tabs. These codes are not mine. I simply put them together to display what I wanted which obviously doesn't seem to work properly...
The following is what happens:
1) If you click on the upper tab, the page doesn't refresh itself.
2) If you click on the lower tab, the page refreshes itself and changes the "id=?" on the address bar which is what I DO NOT want.
Will it be possible for this problem to be fixed?
This is a SAMPLE website so it will not be tidy
http://www.swan10.nl/stuff/testie/testie.php
The CSS were made to display classes however the PHP website only works if these codes are used class="TabView" id="TabView". I know you cannot use "id" more than once so I even made another set of CSS & Javascript for id="Tabview2" etc but it didn't work so I didn't bother uploading them to save space.
I don't know if this is the best code to use but if they aren't please give some suggestions for better codes. Or I may have just missed something tiny and silly.
Please help & thank you in advance!
I highly recommend you look at the Tabs feature of jQuery UI. It will seriously remove all the headaches of trying to figure out logic yourself, it's super easy to set up and use, and LOTS of people use it so there is plently of good information and support floating around on them.
http://jqueryui.com/demos/tabs/
Anyone know a good tutorial of how to make the status bar found in the new facebook? the one on the bottom. looks really cool
i was thinking it was written in either ajax or jquery. but not sure.
Here are some useful links/plugins that might help you:
Positioning the footer
Enable drag/drop of things (like applications)
Tooltip (when hover)
And for the interaction with the server (for new events etc.) you might use the AJAX functionality in jQuery:
In order to have it always be in the bottom, that is more of CSS than javascript.
I think you would get better answers if you were more specific. For example, I would want the answer to revolve around as to how the chatroom works on facebook. Is the javascript request being sent every second to check for new messages? or is there another protocol being used in order to have instant messages?
It's not clear what your are looking for: bar's design or it's functionality. If your are speaking about design you should look into css positioning (absolute). If it's about functionality i suppose that there is some kind of ajax javascript which checks every x seconds if there is change of state, and if there is go deeper and find out what to load.
Why not just download the Facebook source code and take a look at how they do it? They open sourced a lot of the stuff they use/created/enhanced.
Soh Tanaka just put out a great step-by-step tutorial on how to re-create the Facebook Status Bar:
Here's another good starting point: http://www.ben-griffiths.com/project/jquery-position-footer/. If I remember correctly it works in FF & IE & Safari
I looked through the jQuery plugins, and Googled the topic for you. All I could find was this which isn't exactly what you want, but it is a good place to start. With some style changes, and a little tweaking it could easily look exactly like the Facebook bar.
Not sure that this is the type of answer you were looking for, but i've been looking for the same thing and this code seems to at least show how it's done.