:网页加载时的target元素 [英] :target element on page load

查看:187
本文介绍了:网页加载时的target元素的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

网页载入时是否可以有元素:target ed?

Is it possible to have an element :targeted when the page loads?

语言选择,每个只显示在:target 。当index.htm加载时,没有:target ed - 我宁愿让用户看到其中一种语言。

The site has several language choices, each of which display only on :target. When index.htm loads, none is :targeted – I'd rather have the user see one of the languages.

(例如:burlupar.info)

(example: burlupar.info)

推荐答案

我认为最好的选择是避免依赖:target显示/隐藏语言。

I think the best option here is to avoid relying on :target for the display/hide of the languages.

标准是将每个语言div设置为display:none,然后使用JavaScript根据需要显示/隐藏div。

The standard is to set each of the language divs as display:none, and then use JavaScript to show/hide the divs as needed.

例如,我将使用jQuery的show( http: //api.jquery.com/show/ )并隐藏( http://api.jquery。 com / hide / )功能可在单击其中一个链接时切换语言显示。设置完成后,您可以在默认情况下将其中一种语言设置为在CSS中显示。

For example, I would use jQuery's show (http://api.jquery.com/show/) and hide (http://api.jquery.com/hide/) functions to toggle the language display when one of the links is clicked. Once that is set up you can simply have one of the languages set to display in CSS by default.

这篇关于:网页加载时的target元素的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆