整合營銷服務商

          電腦端+手機端+微信端=數據同步管理

          免費咨詢熱線:

          9個鼠標懸停圖片遮罩,高亮動畫特效,html頁面源碼

          家好,今天給大家介紹一款, 一組9個鼠標懸停圖片高亮動畫特效html頁面源碼,(圖1)。送給大家哦,獲取方式在本文末尾。

          圖1

          鼠標經過圖片上方就會有相應的特效(圖2)

          圖2

          源碼完整,需要的朋友可以下載學習(圖3)

          圖3

          本源碼編碼:10178,需要的朋友,點擊下面的鏈接后,搜索10178,即可獲取。

          就愛UI - 分享UI設計的點點滴滴



          tml

          <!DOCTYPE html>

          <html>

          <head>

          <meta charset="utf-8">

          <title>點擊彈窗遮罩</title>

          </head>

          <body>

          <button id="btn">點擊</button>

          <!-- 遮罩 -->

          <div class="cover" id="cover"></div>

          <!-- 彈框 -->

          <div class="grid" id="grid_box">

          <span class="grid_close">x</span>

          <h3>標題</h3>

          <div>hahaha</div>

          </div>

          </body>

          </html>

          css

          <style type="text/css">

          .cover{

          display: none;

          position: fixed;

          width:100%;

          height:100%;

          z-index:2;

          background: rgba(102,102,102,0.7);

          top:0;

          left:0;

          }

          .grid{

          display: none;

          position: fixed;

          z-index: 3;

          width: 500px;

          min-height: 300px;

          top:50%;

          left:50%;

          margin: -150px 0 0 -250px;

          background: #fff;

          padding: 15px;

          border-radius:10px;

          }

          .grid_close{

          background: #fff;

          float:right;

          }

          </style>

          js

          <script type="text/javascript">

          var Btn = document.getElementById('btn'),

          Cover = document.getElementById('cover'),

          Box = document.getElementById('grid_box'),

          GridClose = Box.getElementsByClassName('grid_close')[0];

          //點擊彈出彈窗

          Btn.onclick =function(){

          ShowHide(true,Cover,Box);

          }

          //點擊關閉按鈕關閉彈窗

          GridClose.onclick=function(){

          ShowHide(false,Cover,Box);

          }

          //點擊遮罩空白關閉彈窗

          Cover.onclick=function(){

          ShowHide(false,Cover,Box);

          }

          //關閉公用方法

          function ShowHide(Bool,item1,item2){

          for (var i = 1,len=arguments.length; i<len; i++) {

          if (Bool) {

          arguments[i].style.display="block";

          }else{

          arguments[i].style.display="none";

          }

          }

          }

          </script>

          間如流水,只能流去不流回!

          點贊再看,養成習慣,這是您給我創作的動力!

          本文 Dotnet9 https://dotnet9.com 已收錄,站長樂于分享dotnet相關技術,比如Winform、WPF、ASP.NET Core、Xamarin.Forms等,亦有C++桌面相關的Qt Quick和Qt Widgets等,只分享自己熟悉的、自己會的。

          閱讀導航:

          • 一、先看效果
          • 二、本文背景
          • 三、代碼實現
          • 四、文章參考
          • 五、代碼下載

          一、先看效果

          二、本文背景

          YouTube Design com WPF 大神處習得,常用的遮罩對話框實現,使用的開源 C# WPF控件庫 MaterialDesignInXAML ,本站曾有介紹:開源C# WPF控件庫《MaterialDesignInXAML》。

          三、代碼實現

          3.1 添加Nuget庫

          站長使用.Net Core 3.1創建的WPF工程,創建“ScreenOverlayMessage”解決方案后,需要添加兩個Nuget庫:MaterialDesignThemes和MaterialDesignColors,上圖的效果是使用該控件庫實現的,非常強大。

          3.2 工程結構

          不需要截圖,只修改了兩個文件,App.xaml添加MD控件4個樣式文件,MainWindow主窗口實現效果。

          3.3 App.xaml引入MD控件樣式

          <Application x:Class="DropDownMenu.App"
                       xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                       xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                       xmlns:local="clr-namespace:DropDownMenu"
                       StartupUri="MainWindow.xaml">
              <Application.Resources>
                  <ResourceDictionary>
                      <ResourceDictionary.MergedDictionaries>
                          <ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.Light.xaml"/>
                          <ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.Defaults.xaml"/>
                          <ResourceDictionary Source="pack://application:,,,/MaterialDesignColors;component/Themes/Recommended/Primary/MaterialDesignColor.Blue.xaml"/>
                          <ResourceDictionary Source="pack://application:,,,/MaterialDesignColors;component/Themes/Recommended/Accent/MaterialDesignColor.Indigo.xaml"/>
                      </ResourceDictionary.MergedDictionaries>
                  </ResourceDictionary>
              </Application.Resources>
          </Application>

          3.4 主窗體

          MainWindow.xaml,整體布局,看上圖加上下面的界面代碼,添加界面左上角logo圖標、左側導航菜單等,下面即是全部代碼。

          <Window x:Class="ScreenOverlayMessage.MainWindow"
                  xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                  xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                  xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
                  xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
                  xmlns:local="clr-namespace:ScreenOverlayMessage"
                  mc:Ignorable="d"
                  xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes" MouseDown="Window_MouseDown"
                  Title="MainWindow" Height="576" Width="1024" ResizeMode="NoResize" WindowStartupLocation="CenterScreen" WindowStyle="None" Background="#FF423A3A">
              <Grid>
                  <materialDesign:DialogHost BorderBrush="{DynamicResource MaterialDesignDivider}">
                      <materialDesign:DialogHost.DialogContent>
                          <Grid Width="300" Height="150" HorizontalAlignment="Center">
                              <StackPanel Orientation="Horizontal" Margin="15">
                                  <materialDesign:PackIcon Kind="Folder" Foreground="{StaticResource PrimaryHueMidBrush}" Width="50" Height="50"/>
                                  <TextBlock Foreground="Gray" Width="200" Margin="15 5" TextWrapping="Wrap">
                                      允許應用程序訪問您計算機上的照片、媒體和文件?
                                  </TextBlock>
                              </StackPanel>
                              <StackPanel Orientation="Horizontal" HorizontalAlignment="Right" VerticalAlignment="Bottom" Margin="15">
                                  <Button Command="{x:Static materialDesign:DialogHost.CloseDialogCommand}" Style="{DynamicResource MaterialDesignFlatButton}" Margin="4" VerticalAlignment="Center">
                                      拒絕
                                  </Button>
                                  <Button Command="{x:Static materialDesign:DialogHost.CloseDialogCommand}" Style="{DynamicResource MaterialDesignFlatButton}" Margin="4" VerticalAlignment="Center">
                                      允許
                                  </Button>
                              </StackPanel>
                          </Grid>
                      </materialDesign:DialogHost.DialogContent>
                      <Grid>
                          <StackPanel Width="200" HorizontalAlignment="Left" Background="#FF472076">
                              <Grid Height="150" Background="White">
                                  <Image Source="https://img.dotnet9.com/logo.png"/>
                              </Grid>
                              <Button Style="{StaticResource MaterialDesignFlatButton}" Command="{x:Static materialDesign:DialogHost.OpenDialogCommand}">
                                  <StackPanel Orientation="Horizontal" Height="30">
                                      <materialDesign:PackIcon Kind="PhotoAlbum" Width="20" Height="20" VerticalAlignment="Center"/>
                                      <TextBlock Text="照片" Margin="20 0" FontSize="15" VerticalAlignment="Center"/>
                                  </StackPanel>
                              </Button>
                              <Button Style="{StaticResource MaterialDesignFlatButton}" Command="{x:Static materialDesign:DialogHost.OpenDialogCommand}">
                                  <StackPanel Orientation="Horizontal" Height="30">
                                      <materialDesign:PackIcon Kind="Music" Width="20" Height="20" VerticalAlignment="Center"/>
                                      <TextBlock Text="音樂" Margin="20 0" FontSize="15" VerticalAlignment="Center"/>
                                  </StackPanel>
                              </Button>
                          </StackPanel>
                      </Grid>
                  </materialDesign:DialogHost>
              </Grid>
          </Window>

          重點講解:

          • materialDesign:DialogHost:設置遮罩對話框覆蓋的地方,即彈出遮罩對話框后,背后有陰影的位置。
          • materialDesign:DialogHost.DialogContent:對話框內容,即彈出的對話框配置

          后臺有個拖動窗體代碼:

          private void Window_MouseDown(object sender, MouseButtonEventArgs e)
          {
              DragMove();
          }

          四、文章參考

          建議直接打開大神視頻學習,他的YouTube上還有很多代碼視頻哦,參考:
          參考視頻: Design com WPF: https://www.youtube.com/watch?v=Dwi9o3K73XM

          五、代碼下載

          文章中代碼已經全部貼出。

          除非注明,文章均由 Dotnet9 整理發布,歡迎轉載。

          轉載請注明本文地址:https://dotnet9.com/6769.html


          主站蜘蛛池模板: 亚洲熟女一区二区三区| 天堂va在线高清一区 | 精品日产一区二区三区手机| 久久影院亚洲一区| 无码精品人妻一区二区三区免费看| 国产波霸爆乳一区二区| 精品国产AⅤ一区二区三区4区| 成人区人妻精品一区二区不卡| 精品福利一区二区三| 日本一区午夜爱爱| 久久精品免费一区二区| AV天堂午夜精品一区| 免费在线观看一区| 无码丰满熟妇浪潮一区二区AV| 中文字幕一区二区三区精华液| 久久99国产精一区二区三区| 在线视频一区二区日韩国产| 蜜桃臀无码内射一区二区三区| 中文字幕一区二区三区乱码| 亚洲国产精品第一区二区三区| 国产精品无码一区二区在线| 亚洲美女视频一区| 国产吧一区在线视频| 四虎成人精品一区二区免费网站| 亚洲综合国产一区二区三区| 日韩高清一区二区| 人妖在线精品一区二区三区| 538国产精品一区二区在线| 狠狠综合久久av一区二区| 亚洲综合一区二区| 国产在线一区二区杨幂| 亚洲AV无码一区二区三区在线| 国产日韩AV免费无码一区二区三区 | 精品一区二区三区四区在线| 亚洲啪啪综合AV一区| 91视频一区二区| 亚洲熟女综合色一区二区三区| 亚洲综合一区国产精品| 一区视频免费观看| 久久99热狠狠色精品一区| 日韩AV无码一区二区三区不卡 |