JQuery与CSS之图片上放置button
position:relative日常应用的时候通常是设置给position:absolute;的父层的,
父层position:relative; 子层position:absolute;的话, 就是按照父层的边界进行定位的,
不然position:absolute 会逐层向上寻找设置了position:relative的元素边界, 直到body元素..
第一种写法(连同CSS一起追加进去)
var freeOne="";
freeOne=$(".freePreviewOne").attr("data-url");
if(freeOne==null){
//没有免费视频
}else{
$("#coursePicture").append("<a class='hide-650 fade5' "+
"style='top:94px;left:150px;position:absolute;z-index:100; " +
" width: 180px;height: 60px;border: 2px solid white;" +
"display: block;color: white;text-decoration: none;" +
"letter-spacing: 1px;font-size: 16px;line-height: 20px;" +
"text-align:center;padding-top:18px;" +
"background-color: rgba(0, 0, 0, 0.44);" +
"-webkit-backface-visibility: hidden;-webkit-transition: all .3s ease-in-out;" +
"-moz-transition: all .3s ease-in-out;-ms-transition: all .3s ease-in-out;" +
"-o-transition: all .3s ease-in-out;" +
"border-radius: 10px;'"+ "href='#modal' data-toggle='modal' "+
"data-url='"+freeOne+"'> "+
"<span class='contactus' style='font-size:26px;'>试 看</span> <span class='glyphicon glyphicon-play' style='font-size:20px;top:0;bottom:2px;'></span> </a>"
);
}
页面:
<div class="es-row-wrap container-gap course-cover"> <div class="row row-5-7 course-cover-heading">
<div id="coursePicture" class="col-sm-5 picture hidden-xs" style="position: relative;">
<#if course.coverImage?has_content>
<img src="${course.coverImage}" class="img-responsive" width="436px" height="245px" />
<#else>
<img src="/resources/assets/img/default/course-large.png" class="img-responsive" />
</#if>
</div>
</div> </div>
另外一种写法:
//在课程图片上放置按钮
/* <a class="button hide-650 fade5" href="#modal" data-toggle="modal" data-url="/course/hyjgz2np/lesson/preview?lectureId=hyjgz2np0.49618492345325650.04212287697009742"> <span class="contactus"><strong>试看</strong></span> </a>
*/ //$("#coursePicture").append("<a class='btn btn-sm btn-info' href='#' style='top:120px;left:180px;position:absolute;z-index:100;'>试看</a>");
var freeOne="";
freeOne=$(".freePreviewOne").attr("data-url");
if(freeOne==null){
//没有免费视频
}else{
$("#coursePicture").append("<a class='freePreviewPicture hide-650 fade5' "+
"href='#modal' data-toggle='modal' "+
"data-url='"+freeOne+"'> "+
"<span class='contactus' style='font-size:26px;'>试 看</span> <span class='glyphicon glyphicon-play' style='font-size:20px;top:0;bottom:2px;'></span> </a>"
);
}
页面:
<style>
.freePreviewPicture{
top:94px;
left:150px;
position:absolute;
z-index:100;
width: 180px;
height: 60px;
border: 2px solid white;
display: block;
color: white;text-decoration: none;
letter-spacing: 1px;font-size: 16px;
line-height: 20px;
text-align:center;padding-top:18px;
background-color: rgba(0, 0, 0, 0.44);
-webkit-backface-visibility: hidden;
-webkit-transition: all .3s ease-in-out;
-moz-transition: all .3s ease-in-out;
-ms-transition: all .3s ease-in-out;
-o-transition: all .3s ease-in-out;
border-radius: 10px;
}
</style>
<div class="es-row-wrap container-gap course-cover"> <div class="row row-5-7 course-cover-heading">
<div id="coursePicture" class="col-sm-5 picture hidden-xs" style="position: relative;">
<#if course.coverImage? has_content>
<img src="${course.coverImage}" class="img-responsive" width="436px" height="245px" />
<#else>
<img src="/resources/assets/img/default/course-large.png" class="img-responsive" />
</#if>
</div>
</div> </div>
执行效果图:
JQuery与CSS之图片上放置button的更多相关文章
- 在php中使用jquery uploadify进行多图片上传
jquery uploadify是一款Ajax风格的批量图片上传插件,在PHP中使用jquery uploadify很方便,请按照本文介绍的方法和步骤,为你的PHP程序增加jquery uploadi ...
- Uploadify & jQuery.imgAreaSelect 插件实现图片上传裁剪
在网站中需要一个图片上传裁剪的功能,借鉴这篇文章 Ajax+PHP+jQuery图片截图上传 的指点,找到了jquery.imgAreaSelect这个不错插件,能对图片进行自定义区域选择并给出坐标, ...
- jQuery:[1]实现图片上传并预览
jQuery:[1]实现图片上传并预览 原理 预览思路 1.当上传对象的input被触发并选择本地图片之后获取要上传的图片对象的URL: 2.把对象URL赋值给实现写好的img标签的src属性 Fil ...
- jquery php ajax多图片上传.上传进度,生成缩略图
本例用到其他2个php class.upload.php和 functions.php还有css和js以及img文件 下载地址为www.freejs.net/demo/91/down.zip 演示 J ...
- jQuery实现鼠标放到图片上,放大图片
<script src="../../Script/jquery-1.7.2.js" type="text/javascript"></scr ...
- html+css 在图片上添加文字
html <view class="container"> <image class="" src="{{book.image}}& ...
- jquery+html5实现单张图片上传预览
js: if (window.File && window.FileReader && window.FileList && window.Blob){ ...
- thinkphp5+layui多图片上传
准备资料 下载layui <!DOCTYPE html> <html> <head> <meta charset="utf-8"> ...
- [python][flask] Flask 图片上传与下载例子(支持漂亮的拖拽上传)
目录 1.效果预览 2.新增逻辑概览 3.tuchuang.py 逻辑介绍 3.1 图片上传 3.2 图片合法检查 3.3 图片下载 4.__init__.py 逻辑介绍 5.upload.html ...
随机推荐
- 关于Windows通过远程桌面訪问Ubuntu
关于Windows通过远程桌面訪问Ubuntu 问题及目标 Window环境通过远程桌面訪问Ubuntu Ubuntu机器端 1. 安装所需软件包 sudoapt-get install xrdp ...
- Libevent学习笔记
学习: /Users/baidu/Documents/Data/Interview/服务器-检索端/libevent参考手册(中文版).pdf 讲的不好.翻译的..
- ios网络学习------3 用非代理方法实现异步post请求
#pragma mark - 这是私有方法.尽量不要再方法中直接使用属性,由于一般来说属性都是和界面关联的,我们能够通过參数的方式来使用属性 #pragma mark post登录方法 -(void) ...
- POJ 1836 Alignment(DP max(最长上升子序列 + 最长下降子序列))
Alignment Time Limit: 1000MS Memory Limit: 30000K Total Submissions: 14486 Accepted: 4695 Descri ...
- 【VC编程技巧】窗口☞3.5对单文档或者多文档程序制作启动画面
(一)概要: 文章描写叙述了如何通过Visual C++ 2012或者Visual C++ .NET,为单文档或者多文档程序制作启动画面.在Microsoft Visual Studio 6.0中对于 ...
- hdoj--2803--The MAX(水题)
The MAX Time Limit: 4000/2000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Su ...
- C#读出文本文件内容,遍历数组筛选出 含有汉字对应的拼音字符
情景描述:由于任务需要,现有一用户表数据,用户名 字段 在新增用户时,输入中文和拼音两种,先要区分同时含有中文和拼音字母的用户名.由于数据很多,可以通过一段代码完成查询: 前提:在阅读本文之前可以先了 ...
- 剑指offer——05用两个栈实现队列(Python3)
思路:(转) 代码: # -*- coding:utf-8 -*-class Solution: stack1 = [] stack2 = [] def push(self, node): self. ...
- k8s 架构浅析
文章目录 目录 Kubernetes 的电梯间演讲 Kubernetes 的核心层级对象 Kubernetes 的组件架构 Kubernetes 的组件通信协议/接口 Kubernetes 的分层架构 ...
- Java基础——GridBagLayout布局
1.GridBagLayout布局管理器非常灵活,每个 GridBagLayout 对象维持一个动态的矩形单元网格: 2.需要和它的约束类(GridBagConstraints类)一起使用: 3.Gr ...