Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
私はjQueryが初めてで、次のタイプのようなメニューがあります
いくつかのメニューをクリックした後、このようにメニューの位置を変更してから、このような別のメニューの位置をクリックします。それぞれページをリロードした後にメニューの位置を変更するには?
これを実現する最善の方法は、次のようなクラスで要素をスタイルすることです。
'main' 'sub'.
メインのクラスを持つものは、左側に配置する CSS スタイルがあります。
次に、jQuery を使用して、クリックするだけでクラスを切り替えます。
$('a').click(function(){ $(a).removeClass('main'); $(this).addClass('main'); });