如何在asp.net mvc中更改页面加载时的背景图像 [英] How to change background image on page load in asp.net mvc

查看:465
本文介绍了如何在asp.net mvc中更改页面加载时的背景图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在asp.net中更改页面加载时的背景图像mvc

解决方案

当页面加载时,你可以触发jQuery来改变背景图像你的HTML文档。这取决于您将背景图像,身体或div容器设置为哪个元素,因为ASP.NET允许您创建类似的布局,然后将网站的内容加载到布局中。



无论如何,改变jQuery中背景图像的代码就像更改元素的CSS属性一样简单。



  //  确保你的项目中包含jQuery  


document )。ready( function (){
// 正文已加载


' body')。load(< span class =code-keyword> function (){
// 更改背景 - 图像

How to change background image on page load in asp.net mvc

解决方案

When the page loads, you can trigger the jQuery to change the background-image of your HTML document. It depends on which element you set the background-image, to your body or to your div container because ASP.NET allows you to create a similar layout and then load your website's content into the layout.

Anyway, the code to change the background-image in jQuery is as simple as changing the CSS properties of the elements.

// Make sure you're having jQuery included to your project


(document).ready(function () { // body has been loaded


('body').load(function () { // Change the background-image


这篇关于如何在asp.net mvc中更改页面加载时的背景图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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