{"id":1131,"date":"2017-11-03T13:54:25","date_gmt":"2017-11-03T10:54:25","guid":{"rendered":"http:\/\/starhack.ru\/?p=1131"},"modified":"2021-01-11T16:01:07","modified_gmt":"2021-01-11T13:01:07","slug":"interaction-media-features","status":"publish","type":"post","link":"http:\/\/starhack.ru\/interaction-media-features\/","title":{"rendered":"Interaction Media Features"},"content":{"rendered":"

Interaction Media Features — \u044d\u0442\u043e \u0442\u0438\u043f \u043c\u0435\u0434\u0438\u0430-\u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u0432 \u0441\u0442\u0438\u043b\u044f\u0445. \u041e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442 \u043a\u0430\u043a\u0438\u043c \u043f\u0443\u0442\u0435\u043c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u043c\u043e\u0436\u0435\u0442 \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u043e\u0432\u0430\u0442\u044c \u0441 \u0432\u0430\u0448\u0438\u043c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435\u043c<\/a>.
\n\u041f\u0440\u043e\u0441\u0442\u043e\u0439 \u0441\u043f\u043e\u0441\u043e\u0431 \u0440\u0430\u0437\u0434\u0435\u043b\u0438\u0442\u044c \u0441\u0442\u0438\u043b\u0438 \u0434\u043b\u044f \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432 \u0441 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u043c\u0438 \u0442\u0438\u043f\u0430\u043c\u0438 \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0442\u0430\u0447-\u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430 \u0438 \u0434\u0435\u0441\u043a\u0442\u043e\u043f, \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u043c\u044b\u0439 \u043c\u044b\u0448\u043a\u043e\u0439.
\n\u0421\u0435\u0439\u0447\u0430\u0441 \u0432\u043e \u043c\u043d\u043e\u0433\u0438\u0445 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430\u0445 \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u044e\u0449\u0438\u0435 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u044e\u0442\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u0440\u0438 \u043d\u0430\u0432\u0435\u0434\u0435\u043d\u0438\u0438 \u043a\u0443\u0440\u0441\u043e\u0440\u0430 \u043c\u044b\u0448\u0438 \u043f\u043e \u0441\u043e\u0431\u044b\u0442\u0438\u044e :hover<\/code>. \u041d\u043e \u043d\u0430 \u0442\u0430\u0447-\u0434\u0435\u0432\u0430\u0439\u0441\u0430\u0445 \u0442\u0430\u043a\u043e\u0435 \u0441\u043e\u0431\u044b\u0442\u0438\u0435 \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u0435\u0442 \u043a\u0430\u043a \u043a\u043b\u0430\u0441\u0441. \u0418 \u0432\u043e\u0442 \u0442\u0443\u0442 \u043d\u0430\u043c \u043a\u0430\u043a \u0440\u0430\u0437 \u043f\u0440\u0438\u0433\u043e\u0434\u0438\u0442\u0441\u044f \u0440\u0430\u0441\u0441\u043c\u0430\u0442\u0440\u0438\u0432\u0430\u0435\u043c\u044b\u0439 \u043c\u0435\u0434\u0438\u0430-\u0437\u0430\u043f\u0440\u043e\u0441.
\n\u0412\u043e\u0442 \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u043f\u0440\u0438\u043c\u0435\u0440 \u043a\u043e\u0434\u0430:
\nHTML<\/strong><\/p>\n

<div class=\"parent\">\n  parent\n  <div class=\"child\">child<\/div>\n<\/div>\n<\/code><\/pre>\n

CSS<\/strong><\/p>\n

.parent:not(:hover) .child {\n  \/* \u0437\u0434\u0435\u0441\u044c \u043c\u044b \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u043c \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0442\u044c child \u044d\u043b\u0435\u043c\u0435\u043d\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u0440\u0438 \u043d\u0430\u0432\u0435\u0434\u0435\u043d\u0438\u0438 \u043d\u0430 parent'\u0430 *\/\n  display: none;\n}\n@media (hover:none) {\n  .child {\n\/* \u0430 \u0442\u0443\u0442 \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u043c, \u0447\u0442\u043e child \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u0442\u044c \u0432\u0438\u0434\u0435\u043d \u043d\u0430 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430\u0445, \u0433\u0434\u0435 hover \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u0435\u0442 *\/\n    display: block!important;\n  }\n}\n<\/code><\/pre>\n

\u0418 \u0442\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u043c\u044b \u043f\u043e\u043a\u0430\u0436\u0435\u043c \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044e \u0441 \u0442\u0430\u0447-\u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u043e\u043c \u0442\u043e, \u0447\u0442\u043e \u043d\u0430 \u0435\u043c\u0443 \u043d\u0435\u0434\u043e\u0441\u0442\u0443\u043f\u043d\u043e \u0431\u0435\u0437 \u0441\u043e\u0431\u044b\u0442\u0438\u044f :hover<\/code>.
\n\u0418 \u0436\u0438\u0432\u043e\u0439 \u043f\u0440\u0438\u043c\u0435\u0440 \u043d\u0430 codepen.<\/p>\n

See the Pen Interaction Media Features<\/a> by Sergey Kirichenko (@oknechirik<\/a>) on CodePen<\/a>.<\/p>\n